Please tell me the easiest way to get the serial number of the hard disk (factory), or give the source code on c ++ or assembler.
So here I wrote, gives an error
link to unresolved external _WinMain @ 16 symbol in the ___tmainCRTStartup function
My code does not feel right, so please help, correct errors, and explain what's what.
#include <iostream> #include <windows.h> #include <winioctl.h> #include <tchar.h> using namespace std; _OVERLAPPED ol; _STORAGE_PROPERTY_QUERY spg; LPVOID lpInBuffer[1024]; LPVOID lpOutBuffer[1024]; LPDWORD lpByteReturned; int main() { HANDLE hDevice = CreateFile(_T("\\.\DeviceName"), NULL, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, NULL, NULL); BOOL bResult = DeviceIoControl(hDevice, IOCTL_STORAGE_QUERY_PROPERTY, &spg, sizeof(spg), &spg, sizeof(spg), lpByteReturned, &ol); if(bResult) cout << "Error by DeviceIoControl!!!\n"; else { cout << spg.PropertyId << "\n"; cout << spg.QueryType << "\n"; cout << spg.AdditionalParameters[0] << "\n"; } system("PAUSE"); return 0; }
_tmain()program will be called ...._tmain(). And it is with underscores. So write in it everything you need. EC, but I assume that you have MSVC ++. - gecube