home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Softwarová Záchrana 3
/
Softwarova-zachrana-3.bin
/
pserv.cpl
/
pserv-2.4.exe
/
source
/
2kwrapper.cpp
next >
Wrap
C/C++ Source or Header
|
2005-01-05
|
2KB
|
44 lines
#include "stdafx.h"
#include "2kwrapper.h"
// wrapper for functions available only unter 2k/xp
LPFNQueryServiceStatusEx lpfnQueryServiceStatusEx = NULL;
LPFNQueryServiceConfig2 lpfnQueryServiceConfig2 = NULL;
LPFNEnumServicesStatusEx lpfnEnumServicesStatusEx = NULL;
LPFNChangeServiceConfig2 lpfnChangeServiceConfig2 = NULL;
LPFNGetLongPathName lpfnGetLongPathName = NULL;
class LoadMeAlways
{
public:
LoadMeAlways()
{
HMODULE hModule = LoadLibrary(TEXT("advapi32.dll"));
if( hModule )
{
lpfnQueryServiceStatusEx = (LPFNQueryServiceStatusEx) GetProcAddress(hModule, "QueryServiceStatusEx");
#ifdef UNICODE
lpfnQueryServiceConfig2 = (LPFNQueryServiceConfig2) GetProcAddress(hModule, "QueryServiceConfig2W");
lpfnEnumServicesStatusEx = (LPFNEnumServicesStatusEx) GetProcAddress(hModule, "EnumServicesStatusExW");
lpfnChangeServiceConfig2 = (LPFNChangeServiceConfig2) GetProcAddress(hModule, "ChangeServiceConfig2W");
#else
lpfnQueryServiceConfig2 = (LPFNQueryServiceConfig2) GetProcAddress(hModule, "QueryServiceConfig2A");
lpfnEnumServicesStatusEx = (LPFNEnumServicesStatusEx) GetProcAddress(hModule, "EnumServicesStatusExA");
lpfnChangeServiceConfig2 = (LPFNChangeServiceConfig2) GetProcAddress(hModule, "ChangeServiceConfig2A");
#endif
}
hModule = LoadLibrary(TEXT("kernel32.dll"));
if( hModule )
{
#ifdef UNICODE
lpfnGetLongPathName = (LPFNGetLongPathName) GetProcAddress(hModule, "GetLongPathNameW");
#else
lpfnGetLongPathName = (LPFNGetLongPathName) GetProcAddress(hModule, "GetLongPathNameA");
#endif
}
}
};
LoadMeAlways instance;