User forums > General (but related to Code::Blocks)
Read the wmic or GUID
patrocle:
Hello all coders,
I'm trying to add a way to read wmic or GUID and then use it as a string like that http://prntscr.com/nhk98b
The goal is to identify players using multiple accounts.
I found a sample but i can't compile it, i need some lib :(
--- Code: --- FILE* CommandResult = _popen("wmic csproduct get uuid", "rt"); //send the command to the cmd and return a pointer to the command result
char line[256]; //a buffer to read from the file
while(fgets(line, 256, CommandResult)) printf(line); //read and print all lines one by one
_pclose(CommandResult);
--- End code ---
Can someone help me with a working CB sample? Please
hidefromkgb:
Although this is not related to C::B, I`ll try directing you to an answer.
If I get your problem right, you need to ensure only one instance of your app is running on the target machine. This is how it`s done.
Bear in mind though that this is not in any way a panacea, for sophicticated players may use additional PCs, virtual machines, diassemblers, and lots of other cool things to overcome the restriction you are trying to impose.
patrocle:
Thank you for the reply!
--- Quote ---If I get your problem right, you need to ensure only one instance of your app is running on the target machine. This is how it`s done.
--- End quote ---
No, its only about a UUID , nothing to do with multiple instances. About "virtual machines, diassemblers, and lots of other cool things" is fine, i don't have hackers players.
A sample will really help.
hidefromkgb:
Okay, digging a little bit further into your code snippet I realized that your task is to uniquely identify a Windows PC.
You could`ve stated that earlier =)
Well, getting a unique Windows installation GUID can be done as follows:
--- Code: ---HKEY hKey;
WCHAR *MachineGUID[128];
DWORD dwBufferSize = sizeof(MachineGUID);
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);
if (nError == ERROR_SUCCESS) {
/// do something with MachineGUID...
}
--- End code ---
patrocle:
thanks again, compiled!
now, how could i have a string with uuid?
somthing like that:
--- Code: ---string GetUUID()
{
HKEY hKey;
WCHAR *MachineGUID[128];
DWORD dwBufferSize = sizeof(MachineGUID);
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);
if (nError == ERROR_SUCCESS) {
//do something with MachineGUID...
//return hKey;
}
}
// here i will use the uuid
m_RemoteSocket->PutBytes( m_GPSProtocol->SEND_GPSC_INIT3( 2, GetUUID() ) ); // verify the uuid
--- End code ---
Navigation
[0] Message Index
[#] Next page
Go to full version