Something like this:
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#pragma comment(lib, "user32.lib")
char *GetPassword(char *szFile)
{
unsigned short aAccess2000Decode[] = {
0x6ABA, 0x37EC, 0xD561, 0xFA9C, 0xCFFA, 0xE628, 0x272F, 0x608A,
0x0568, 0x367B, 0xE3C9, 0xB1DF, 0x654B, 0x4313, 0x3EF3, 0x33B1,
0xF008, 0x5B79, 0x24AE, 0x2A7C };
static char str2000[19];
HANDLE hFile;
unsigned short retXPwd[17];
unsigned short wkCode, mgCode;
DWORD nRead;
str2000[0] = 0;
str2000[18] = 0;
hFile = CreateFile(szFile, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
if (hFile != INVALID_HANDLE_VALUE)
{
SetFilePointer(hFile, 66, NULL, FILE_BEGIN); // 67 -> 43h
ReadFile(hFile, &retXPwd, sizeof(short)*17, &nRead, NULL);
SetFilePointer(hFile, 102, NULL, FILE_BEGIN); // 103 -> 67h
ReadFile(hFile, &mgCode, sizeof(short), &nRead, NULL);
CloseHandle(hFile);
mgCode ^= aAccess2000Decode[18];
for (int iCnt = 0; iCnt <= 17; iCnt++) {
wkCode = retXPwd[iCnt] ^ aAccess2000Decode[iCnt];
if (wkCode < 256)
str2000[iCnt] = (char)wkCode;
else
str2000[iCnt] = (char)(wkCode ^ mgCode);
}
}
return str2000;
}
int main(int argc, char **argv)
{
MessageBox(0, GetPassword("test.bin"), 0, MB_OK);
return 0;
}