Kompiluję na windowsie 32 bit, otrzymane exe uruchamiam na 64 bit windowsie, kod pokazuje mi ciągle 32 bity, jak to "obejść" aby zawsze pokazywał prawidłowo? (Tak, wiem, że mam tu mem leak)
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <windows.h>
char *bitowosc()
{
BOOL jest64BitProcesem = 0;
char *bitowoscSystemu = malloc(sizeof(char) * 255);
typedef BOOL (APIENTRY *LPFN_ISWOW64PROCESS)(HANDLE, PBOOL);
LPFN_ISWOW64PROCESS fnIsWow64Process;
HMODULE module = GetModuleHandle("kernel32");
const char nazwaFunkcji[] = "IsWow64Process";
memset(bitowoscSystemu, '\0', 255);
fnIsWow64Process = (LPFN_ISWOW64PROCESS) GetProcAddress(module, nazwaFunkcji);
if(NULL != fnIsWow64Process)
{
if (!fnIsWow64Process(GetCurrentProcess(), &jest64BitProcesem))
{
strcpy(bitowoscSystemu, "32-bit");
return bitowoscSystemu;
}
}
if(jest64BitProcesem != 0)
{
strcpy(bitowoscSystemu, "64-bit");
return bitowoscSystemu;
}
else
{
strcpy(bitowoscSystemu, "32-bit");
return bitowoscSystemu;
}
}
int main()
{
printf("%s\n", bitowosc());
return 0;
}