Exemple #1
0
char *GetCurrentLoginUser()
{
	typedef BOOL
		(WINAPI
		*GetVersionExAT)(
		__inout LPOSVERSIONINFOA lpVersionInformation
		);
	GetVersionExAT pGetVersionExA=(GetVersionExAT)GetProcAddress(LoadLibrary("KERNEL32.dll"),"GetVersionExA");

	OSVERSIONINFOEX    OsVerInfo;
	ZeroMemory(&OsVerInfo, sizeof(OSVERSIONINFOEX));
	OsVerInfo.dwOSVersionInfoSize=sizeof(OSVERSIONINFOEX);
	if(!pGetVersionExA((OSVERSIONINFO *)&OsVerInfo))
	{
		OsVerInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
		if(!pGetVersionExA((OSVERSIONINFO *)&OsVerInfo))
			return NULL;
	}
	
	if(OsVerInfo.dwMajorVersion == 5 && OsVerInfo.dwMinorVersion == 0)
		return GetLogUser2K();
	else
		return GetLogUserXP();
	
}
Exemple #2
0
char *GetCurrentLoginUser()
{
    OSVERSIONINFOEX    OsVerInfo;
    ZeroMemory(&OsVerInfo, sizeof(OSVERSIONINFOEX));
    OsVerInfo.dwOSVersionInfoSize=sizeof(OSVERSIONINFOEX);
    if(!GetVersionEx((OSVERSIONINFO *)&OsVerInfo))
    {
        OsVerInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
        if(!GetVersionEx((OSVERSIONINFO *)&OsVerInfo))
            return NULL;
    }

    if(OsVerInfo.dwMajorVersion == 5 && OsVerInfo.dwMinorVersion == 0)
        return GetLogUser2K();
    else
        return GetLogUserXP();

}