I have following code in Delphi 7 in some function:
var
objServiceConfig: PQueryServiceConfigA;
...
...
objServiceConfig:= AllocMem(anySize);
...
...
QueryServiceConfig(hSCService, objServiceConfig, anySize, anySize2)
.....
.....
I am getting error: E2010 Incompatible types: 'LPQUERY_SERVICE_CONFIGW' and 'PQueryServiceConfigA'
In Delphi 7 everything is working fine but migrating it to Delphi XE4, I am getting this error.
When I change the above declaration objServiceConfig: PQueryServiceConfigA;
to objServiceConfig: LPQUERY_SERVICE_CONFIG;
it works. Is it right or what else I have to do?
Update:
In Delphi XE4 WinSvc, QueryServiceConfig is declared like following
function QueryServiceConfig(hService: SC_HANDLE;
lpServiceConfig: LPQUERY_SERVICE_CONFIG; cbBufSize: DWORD;
var pcbBytesNeeded: DWORD): BOOL; stdcall;
{$EXTERNALSYM QueryServiceConfigA}
function QueryServiceConfigA(hService: SC_HANDLE;
lpServiceConfig: LPQUERY_SERVICE_CONFIGA; cbBufSize: DWORD;
var pcbBytesNeeded: DWORD): BOOL; stdcall;
{$EXTERNALSYM QueryServiceConfigW}
function QueryServiceConfigW(hService: SC_HANDLE;
lpServiceConfig: LPQUERY_SERVICE_CONFIGW; cbBufSize: DWORD;
var pcbBytesNeeded: DWORD): BOOL; stdcall;
In Delphi7, WinSvc, QueryServiceConfig is declared like following
function QueryServiceConfig(hService: SC_HANDLE;
lpServiceConfig: PQueryServiceConfig; cbBufSize: DWORD;
var pcbBytesNeeded: DWORD): BOOL; stdcall;
{$EXTERNALSYM QueryServiceConfigA}
function QueryServiceConfigA(hService: SC_HANDLE;
lpServiceConfig: PQueryServiceConfigA; cbBufSize: DWORD;
var pcbBytesNeeded: DWORD): BOOL; stdcall;
{$EXTERNALSYM QueryServiceConfigW}
function QueryServiceConfigW(hService: SC_HANDLE;
lpServiceConfig: PQueryServiceConfigW; cbBufSize: DWORD;
var pcbBytesNeeded: DWORD): BOOL; stdcall;
It means 2nd parameter in case of Delphi 7 is of type PQueryServiceConfig
/A/W while in Delphi XE4 is of type LPQUERY_SERVICE_CONFIG
/A/W