|
Registriert seit: 15. Apr 2005 8 Beiträge |
#6
ja hast recht.
ich musste erstmal einen tutorial lesen um den c++ syntax einwenig zu verstehen. danke allen die mir geantwortet haben. ich muss nur noch eine header datei umwandeln habe es auch soweit gemacht. wäre super wenn ihr mal schaut ob das so richtig ist.
Code:
so hier mein delphi code:
#ifndef _DLLDef_H_
#define _DLLDef_H_ #pragma pack(push) #pragma pack(4) //Connection specific information typedef struct _ConnectionInfo { DWORD dwPID; bool bIncomingConnection; bool bSSL; DWORD dwOutgoingAddress; unsigned short usOutgoingPort; DWORD dwLocalAddress; //Reserved, not implemented unsigned short usLocalPort; //Reserved, not implemented } ConnectionInfo; #pragma pack(pop) //The callback function //If the callback is called with NULL data and 0 data size it means that the socket was closed typedef DWORD (_stdcall *DLLCallback)(const ConnectionInfo& rConnectionInfo, DWORD dwID, const char* pData, DWORD dwDataSize, bool bOutgoingData, DWORD dwTickCount); typedef DLLCallback PDLLCallback; //Call back for HTTP decoder //Request HTTP information typedef struct _HTTPRequestInformation { const char* pVerb; //Get, post const char* pURL; const char* pHost; } HTTPRequestInformation; //This will be called for HTTP request typedef DWORD (_stdcall *DLLCallbackHTTPRequest)(const ConnectionInfo& rConnectionInfo, DWORD dwID, const HTTPRequestInformation& rInformation, const char* pRequest, DWORD dwRequestSize, DWORD dwFirstTickCount, DWORD dwLastTickCount, bool& rProcess); typedef DLLCallbackHTTPRequest PDLLCallbackHTTPRequest; //Reply HTTP information typedef struct _HTTPReplyInformation { DWORD dwReplyCode; const char* pContentType; } HTTPReplyInformation; //This will be called for HTTP reply typedef DWORD (_stdcall *DLLCallbackHTTPReply)(const ConnectionInfo& rConnectionInfo, DWORD dwID, const HTTPReplyInformation& rInformation, const char* pReplyHeader, DWORD dwReplyHeaderSize, const char* pReply, DWORD dwReplySize, DWORD dwTotalReplyOriginalSize, DWORD dwFirstTickCount, DWORD dwLastTickCount, bool& rServerCheck); typedef DLLCallbackHTTPReply PDLLCallbackHTTPReply; //Callbacks to modify the data structures //The initialize function typedef bool (_stdcall *InitializeProto)(PDLLCallback pCallback, DWORD dwReg); typedef InitializeProto PInitializeProto; //HTTP initialize function typedef bool (_stdcall *InitializeHTTPProto)(PDLLCallback pCallback, PDLLCallbackHTTPRequest pRequestCallback, PDLLCallbackHTTPReply pReplyCallback, DWORD dwReg); typedef InitializeHTTPProto PInitializeHTTPProto; //The uninitialize function typedef void (_stdcall *UninitializeProto)(); typedef UninitializeProto PUninitializeProto; //The license function typedef DWORD (_stdcall *GetInfoProto)(); typedef GetInfoProto PGetInfoProto; //Load/save func typedef bool (_stdcall *LoadSaveProto)(); typedef LoadSaveProto PLoadSaveProto; //Clear data typedef void (_stdcall *ClearDataProto)(); typedef ClearDataProto PClearDataProto; //Enum of the add data typedef enum _AddDataType { adApplication=0, adPort, adIP, adApplicationInv, adPortInv, adIPInv } AddDataType; //Inv types typedef enum _InvType { itApp, itPort, itIP } InvType; //Add data typedef void (_stdcall *AddDataProto)(AddDataType aType, const unsigned short* pData); typedef AddDataProto PAddDataProto; //Query data typedef bool (_stdcall *DoesDataExistsProto)(AddDataType aType, const unsigned short* pData); typedef DoesDataExistsProto PDoesDataExistsProto; //Set inv typedef void (_stdcall *SetInvProto)(InvType aType, bool bSet); typedef SetInvProto PSetInvProto; //Set inv typedef bool (_stdcall *GetInvProto)(InvType aType); typedef GetInvProto PGetInvProto; #endif
Delphi-Quellcode:
unit DLLDef;
interface uses Windows; type {$ALIGN 4} ConnectionInfo = record dwPID: DWORD; bIncomingConnection: Boolean; bSSL: Boolean; dwOutgoingAddress: DWORD; usOutgoingPort: WORD; dwLocalAddress: DWORD; //Reserved, not implemented usLocalPort: WORD; //Reserved, not implemented end; PConnectionInfo = ^ConnectionInfo; {$ALIGN OFF} TDLLCallback = function(rConnectionInfo: PConnectionInfo; dwID: DWORD; pData: Pointer; dwDataSize: DWORD; bOutgoingData: BOOL; dwTickcount): DWORD; stdcall; //typedef DLLCallback PDLLCallback; HTTPRequestInformation = record pVerb : Pchar; pUrl : Pchar; pHost : Pchar; end; pHttpRequestInformation = ^HttpRequestInformation; TDLLCallbackHTTPRequest = function(rConnectionInfo: PConnectionInfo; dwID: DWORD; rInformation: pHttpRequestInformation; pRequest: pointer; dwFirstTickCount: DWORD; dwLastTickCount: DWORD;rProcess : Bool): DWORD; stdcall; HTTPReplyInformation = record dwReplyCode= DWORD; pContentType= Pchar; end; pHTTPReplyInformation= ^HTTPReplyInformation TDLLCallbackHTTPReply = function(rConnectionInfo: PConnectionInfo; dwID: DWORD; rInformation: pHttpRequestInformation; pReplyHeader: pointer; dwReplyHeaderSize: DWORD; pReply: Pointer; dwReplySize: DWORD; dwFirstTickCount: DWORD; dwLastTickCount: DWORD;rServerCheck : Bool): DWORD; stdcall; //typedef DLLCallbackHTTPReply PDLLCallbackHTTPReply; TInitializeProto = function(pCallback: TDLLCallback; dwReg: DWORD): BOOL; stdcall; TInitializeHTTPProto = function(pCallback: TDLLCallback; pRequestCallback: TDLLCallbackHTTPRequest; pReplyCallback: TDLLCallbackHTTPReply; dwReg: DWORD): BOOL; stdcall; //typedef InitializeHTTPProto PInitializeHTTPProto; TUninitializeProto = procedure; stdcall; //typedef UninitializeProto PUninitializeProto; TGetInfoProto = function: DWORD; stdcall; //typedef GetInfoProto PGetInfoProto; TLoadSaveProto = function: Bool; stdcall; //typedef LoadSaveProto PLoadSaveProto; TClearDataProto = procedure; stdcall; //typedef ClearDataProto PClearDataProto; type TAddDataType = ( const adApplication=0, adPort, adIP, adApplicationInv, adPortInv, adIPInv); type TInvType = (itApp, itPort, itIP); TAddDataProto = procedure(pType: TAddDataType; pData: Pchar); stdcall; //typedef AddDataProto PAddDataProto; TDoesDataExistsProto = function(aType: TAddDataType; pData: Pchar ): Bool; stdcall; //typedef DoesDataExistsProto PDoesDataExistsProto; //Set inv TSetInvProto = procedure(pType: TInvType; bSet: bool); stdcall; //typedef SetInvProto PSetInvProto; //Set inv typedef bool (_stdcall *GetInvProto)(InvType aType); TGetInvProto = function(aType: TinvType ): Bool; stdcall; //typedef GetInvProto PGetInvProto; implementation end. |
![]() |
Ansicht |
![]() |
![]() |
![]() |
ForumregelnEs ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.
BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus. Trackbacks are an
Pingbacks are an
Refbacks are aus
|
|
Nützliche Links |
Heutige Beiträge |
Sitemap |
Suchen |
Code-Library |
Wer ist online |
Alle Foren als gelesen markieren |
Gehe zu... |
LinkBack |
![]() |
![]() |