Created
May 26, 2013 04:34
-
-
Save wyyqyl/5651719 to your computer and use it in GitHub Desktop.
Disable file system redirection for system32
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Windows.h> | |
#pragma comment(lib, "Version.lib") | |
BOOL GetAppVersion( char *LibName, WORD *MajorVersion, WORD *MinorVersion, WORD *BuildNumber, WORD *RevisionNumber ) | |
{ | |
DWORD dwHandle, dwLen; | |
UINT BufLen; | |
LPTSTR lpData; | |
VS_FIXEDFILEINFO *pFileInfo; | |
dwLen = GetFileVersionInfoSize( LibName, &dwHandle ); | |
if (!dwLen) | |
return FALSE; | |
lpData = (LPTSTR) malloc (dwLen); | |
if (!lpData) | |
return FALSE; | |
if( !GetFileVersionInfo( LibName, dwHandle, dwLen, lpData ) ) | |
{ | |
free (lpData); | |
return FALSE; | |
} | |
if( VerQueryValue( lpData, "\\", (LPVOID *) &pFileInfo, (PUINT)&BufLen ) ) | |
{ | |
*MajorVersion = HIWORD(pFileInfo->dwFileVersionMS); | |
*MinorVersion = LOWORD(pFileInfo->dwFileVersionMS); | |
*BuildNumber = HIWORD(pFileInfo->dwFileVersionLS); | |
*RevisionNumber = LOWORD(pFileInfo->dwFileVersionLS); | |
free (lpData); | |
return TRUE; | |
} | |
free (lpData); | |
return FALSE; | |
} | |
int main() | |
{ | |
WORD major, minor, build, revision; | |
GetAppVersion("C:\\Windows\\sysnative\\yorath.dll", &major, &minor, &build, &revision); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment