m1zg4rd_PL
Well-known member
- Joined
- Jul 19, 2013
- Messages
- 222
- Reaction score
- 2
Why CLEO snippet return different number than C++ implementation of getting Volume Serial ID?
It return 1217173053
It return -1767286668
What is the difference in that numbers? Integer variable is out of range?
EDIT: Ok, It's out of range error, Integer bigger than 2147483647 changes to -2147483648 + value that is out of range, so the real number readed by CLEO is 2527680628, but still it's not equal to value from C++ program (1217173053) :table_flip:
EDIT2: On the other computer, the problem don't appear, value readed by program is equal to value from cs file: 1991520658, because It's smaller than range limit: 2147483647.
Code:
#include <stdio.h>
#include <iostream>
#include <fstream>
#include <string>
#include <windows.h>
using namespace std;
int main()
{
printf("getting volume info");
CHAR szVolumeNameBuffer[12]; //this will have the name of your drive
DWORD dwVolumeSerialNumber; //this will have the serial number of your drive
DWORD dwMaximumComponentLength; //this is the max length in between each \ in a path
DWORD dwFileSystemFlags; //this will return flags about the drive's file system
CHAR szFileSystemNameBuffer[10]; //this will contain the type of file system (ex: NTFS)
GetVolumeInformationA((LPCSTR)"C:\\", (LPSTR)szVolumeNameBuffer, 12, &dwVolumeSerialNumber, &dwMaximumComponentLength, &dwFileSystemFlags, (LPSTR)szFileSystemNameBuffer, 10);
ofstream myfile;
myfile.open ("example.txt");
myfile << dwVolumeSerialNumber;
myfile.close();
return 0;
}
It return 1217173053
Code:
{$CLEO .cs}
thread "get_serial"
wait 3000
:get_serial
wait 10
if
0AA2: 1@ = load_library "kernel32.dll"
then
if
0AA4: 2@ = get_proc_address "GetVolumeInformationA" library 1@
then
0AC7: 0@ = var 0@v offset
0AA5: call 2@ num_params 8 pop 0 0 0 0 0 0@ 0 0 0
0AF1: write_int 0@ to_ini_file "CLEO\TESTSERIAL.INI" section "MAIN" key "SERIAL"
end
end
0AA3: free_library 1@
004E: end_thread
It return -1767286668
What is the difference in that numbers? Integer variable is out of range?
EDIT: Ok, It's out of range error, Integer bigger than 2147483647 changes to -2147483648 + value that is out of range, so the real number readed by CLEO is 2527680628, but still it's not equal to value from C++ program (1217173053) :table_flip:
EDIT2: On the other computer, the problem don't appear, value readed by program is equal to value from cs file: 1991520658, because It's smaller than range limit: 2147483647.