User forums > General (but related to Code::Blocks)

Read the wmic or GUID

<< < (2/4) > >>

hidefromkgb:

--- Code: ---ULONG GetUUID(WCHAR *MachineGUID, DWORD *dwBufferSize) {
HKEY hKey;
ULONG nError;

RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Cryptography", 0, KEY_READ, &hKey);
nError = RegQueryValueExW(hKey, L"MachineGuid", 0, NULL, (LPBYTE)MachineGUID, dwBufferSize);
RegCloseKey(hKey);
return nError;
}

WCHAR MachineGUID[512];
DWORD dwBufferSize = sizeof(MachineGUID);

if (GetUUID(MachineGUID, &dwBufferSize) == ERROR_SUCCESS) {

// convert MachineGUID from WCHAR* to string
...

m_RemoteSocket->PutBytes( m_GPSProtocol->SEND_GPSC_INIT3( 2, stringMachineGUID ) );
}
--- End code ---

patrocle:

added your code: http://prntscr.com/nhxvs9 


and i got this error: http://prntscr.com/nhxvgi

stahta01:
Please read this FAQ and this website rules.
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F
http://forums.codeblocks.org/index.php/topic,9996.0.html

Tim S.

hidefromkgb:

--- Quote from: patrocle on April 28, 2019, 06:06:25 pm ---and i got this error: http://prntscr.com/nhxvgi

--- End quote ---
Of course, that`s because I don`t know which data type that SEND_GPSC_INIT3() function accepts, so I considered it to be up to you to convert…

patrocle:
but the
--- Code: ---stringMachineGUID
--- End code ---
is not declarated and i dont think is a string, look to be a char.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version