H
hikkk
Unregistered / Unconfirmed
GUEST, unregistred user!
以下是调用deadll.dll的C语言代码,对应Delphi中如何引用这个DLL?主要是Delphi如何对应C的参数类型问题,请提供详细代码?!
#include <stdio.h>
#include <string.h>
#include "standard.h"
#include "Windows.h"
typedef void (__stdcall*Bank_GetMac)
(bptr Mac_SourceData, word SouceData_Len,bptr mackey ,bptr random ,bptr mac);
void main()
{
HMODULE hModule
byte data[9],key[9];
byte macsouce[500];
byte mac[9];
int a;
int i;
Bank_GetMac bg;
hModule = LoadLibrary("deadll.dll");
bg = (Bank_GetMac)GetProcAddress(hModule, "Bank_GetMac");
strcpy((char*)data, "00000000");
strcpy((char*)key, "11111111");
memset(macsouce,0,sizeof(macsouce));
printf("encrypt_result=");
for (i=0;i<8
i++)
printf("%02x",(bptr)*&data);
printf("/n");
strcpy((char*)data, "00000000");
memcpy(macsouce,"11234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz+-*&",257);
bg(macsouce, 257, key ,data, mac);
a=sizeof(word);
printf("mac_result=");
for (i=0;i<8
i++)
printf("%02x",(bptr)*&mac);
printf("/n");
printf("decrypt_result=");
for (i=0;i<8
i++)
printf("%02x",(bptr)*&data);
printf("/n");
}
!!!!!!以下是Standard.h的代码!!!!!!!
#ifndef _STANDARD_H_
#define _STANDARD_H_
typedef unsigned char byte;
typedef byte* bptr;
typedef char* cptr;
typedef unsigned short word;
typedef word* wptr;
typedef unsigned long dword;
typedef dword* dwptr;
#define bool int
#define Boolean bool
#define true 1
#define false 0
#endif
#include <stdio.h>
#include <string.h>
#include "standard.h"
#include "Windows.h"
typedef void (__stdcall*Bank_GetMac)
(bptr Mac_SourceData, word SouceData_Len,bptr mackey ,bptr random ,bptr mac);
void main()
{
HMODULE hModule
byte data[9],key[9];
byte macsouce[500];
byte mac[9];
int a;
int i;
Bank_GetMac bg;
hModule = LoadLibrary("deadll.dll");
bg = (Bank_GetMac)GetProcAddress(hModule, "Bank_GetMac");
strcpy((char*)data, "00000000");
strcpy((char*)key, "11111111");
memset(macsouce,0,sizeof(macsouce));
printf("encrypt_result=");
for (i=0;i<8
i++)
printf("%02x",(bptr)*&data);
printf("/n");
strcpy((char*)data, "00000000");
memcpy(macsouce,"11234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz+-*&",257);
bg(macsouce, 257, key ,data, mac);
a=sizeof(word);
printf("mac_result=");
for (i=0;i<8
i++)
printf("%02x",(bptr)*&mac);
printf("/n");
printf("decrypt_result=");
for (i=0;i<8
i++)
printf("%02x",(bptr)*&data);
printf("/n");
}
!!!!!!以下是Standard.h的代码!!!!!!!
#ifndef _STANDARD_H_
#define _STANDARD_H_
typedef unsigned char byte;
typedef byte* bptr;
typedef char* cptr;
typedef unsigned short word;
typedef word* wptr;
typedef unsigned long dword;
typedef dword* dwptr;
#define bool int
#define Boolean bool
#define true 1
#define false 0
#endif