c++ STRUCTURE data types

Post Reply
User avatar
don lowenstein
Posts: 196
Joined: Mon Oct 17, 2005 9:09 pm
Contact:

c++ STRUCTURE data types

Post by don lowenstein »

I need to call a 64-bit dll with the following parms:

c++ call:

SOCKET WINAPI InetConnect(
LPCTSTR lpszHostName,
UINT nPort,
UINT nProtocol,
UINT nTimeout,
DWORD dwOptions,
LPSECURITYCREDENTIALS lpCredentials
);

The LPSECURITYCREDENTIALS data type is a user defined c++ structure:

typedef struct _SECURITYCREDENTIALS
{
DWORD dwSize;
DWORD dwProtocol;
DWORD dwOptions;
DWORD dwReserved;
LPCTSTR lpszHostName;
LPCTSTR lpszUserName;
LPCTSTR lpszPassword;
LPCTSTR lpszCertStore;
LPCTSTR lpszCertName;
LPCTSTR lpszKeyFile;
} SECURITYCREDENTIALS, *LPSECURITYCREDENTIALS;



**************************************************************************************************

Harbour / Fivewin equivalent:
DLL32 FUNCTION InetConnect( lpszHostName AS LPSTR, ;
nPort AS _INT, ;
nProtocol AS _INT, ;
nTimeout AS _INT, ;
dwOptions AS DWORD, ;
lpCredentials AS LPSECURITYCREDENTIALS ) ;
AS LONG ;
PASCAL FROM "InetConnectA" ;
LIB M->HDLL


My question is, how would I create a LPSECURITYCREDENTIALS data variable for passing to the DLL32 FUNCTION?

Then, I need to populate:
LPSECURITYCREDENTIALS.lpszCertStore
LPSECURITYCREDENTIALS.lpszCertName

Thanks in advance.

don




***************************************************************************************************
Don Lowenstein
www.laapc.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: c++ STRUCTURE data types

Post by Antonio Linares »

Don,

@lpCredentials AS PTR

STRUCT oCredentials
MEMBER dwSize AS DWORD
MEMBER dwProtocol AS DWORD
MEMBER dwOptions AS DWORD
MEMBER dwReserved AS DWORD
MEMBER lpszHostName AS LPSTR
MEMBER lpszUserName AS LPSTR
MEMBER lpszPassword AS LPSTR
MEMBER lpszCertStore AS LPSTR
MEMBER lpszCertName AS LPSTR
MEMBER lpszKeyFile AS LPSTR
ENDSTRUCT

@oCredentials:cBuffer
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
don lowenstein
Posts: 196
Joined: Mon Oct 17, 2005 9:09 pm
Contact:

Re: c++ STRUCTURE data types

Post by don lowenstein »

where in the code does this go?
do you have a small code snippet?
Don Lowenstein
www.laapc.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: c++ STRUCTURE data types

Post by Antonio Linares »

STRUCT oCredentials
MEMBER dwSize AS DWORD
MEMBER dwProtocol AS DWORD
MEMBER dwOptions AS DWORD
MEMBER dwReserved AS DWORD
MEMBER lpszHostName AS LPSTR
MEMBER lpszUserName AS LPSTR
MEMBER lpszPassword AS LPSTR
MEMBER lpszCertStore AS LPSTR
MEMBER lpszCertName AS LPSTR
MEMBER lpszKeyFile AS LPSTR
ENDSTRUCT

oCredentials:dwSize = oCredentials:SizeOf()
oCredentials:lpszCertStore = cCertStore
oCredentials:lpszCertName = cCertName

INetConnect( ..., ..., ..., ..., ..., @oCredentials:cBuffer )

...

DLL32 FUNCTION InetConnect( lpszHostName AS LPSTR, ;
nPort AS _INT, ;
nProtocol AS _INT, ;
nTimeout AS _INT, ;
dwOptions AS DWORD, ;
@lpCredentials AS PTR ) ;
AS LONG ;
PASCAL FROM "InetConnectA" ;
LIB M->HDLL
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply