SPecs of comp

Go down

SPecs of comp Empty SPecs of comp

Post by Aker on Tue Apr 19, 2011 7:44 pm

Well i put together a spec reader, it creates a file in the C:/perflogs/hwid.txt and writes [1.ram, available ram, HWID, comp name, file sys name]

Here is code
Code:



#include <stdio.h>
#include <Windows.h>
#include <tchar.h>

struct vars
{
   TCHAR volname[100];
   TCHAR filename[20];
   DWORD sernum;
   DWORD maxfilename;
   DWORD sysf;

};

int main(void)
{

   struct vars v;

   char cName [MAX_COMPUTERNAME_LENGTH + 1];
   DWORD cNameDW = sizeof ( cName );

   FILE *hwidf;

   errno_t openhd;
   openhd = fopen_s(&hwidf, "C://perflogs//hwid.txt", "w+");

   MEMORYSTATUSEX status;
   GlobalMemoryStatusEx(&status);


   HW_PROFILE_INFOA hwid;
   GetCurrentHwProfileA(&hwid);

   HW_PROFILE_INFOA hwidt;
   GetCurrentHwProfileA(&hwidt);

   if(::GetVolumeInformation("C://", v.volname, sizeof( v.volname ), &v.sernum,  &v.maxfilename, &v.sysf, v.filename, sizeof ( v.filename ) == TRUE))
   {
      printf("Serial Number: %s\n", v.sernum);
      printf("File System Name: %s\n", v.filename);
   }


   _tprintf(_T("Ram installed is: %s \n", status.ullTotalPhys));
   _tprintf(_T("Ram Available: %s \n", status.ullAvailPhys));
   _tprintf(_T("ID: %s\n"), hwidt.szHwProfileGuid);
   _tprintf(_T("Profile: %s\n"), hwidt.szHwProfileName);

   fprintf(hwidf, "HWID: %s\n\n", hwidt.szHwProfileGuid    );
   fprintf(hwidf, "Name: %s", hwidt.szHwProfileName        );
   fprintf(hwidf, "Ram Installed: %s", status.ullTotalPhys );
   fprintf(hwidf, "Ram Available: %s", status.ullAvailPhys );
   fprintf(hwidf, "Serial Number: %s", v.sernum            );
   fprintf(hwidf, "File System Name: %s", v.filename      );

   /*if(!strcmp(hwid.szHwProfileGuid, "{846ee340-7039-11de-9d20-806e6f6e6963434343}"))
   {
      puts("HWID Accepted.\n");
   }
   else
   {
      puts("HWID Declined, closing.\n");
      Sleep(1000);
      exit(0);
   }*/


   fclose(hwidf);
   getchar();

   return (0);
}

Also btw dont ask why i put my vars in a struct o.0

Aker
Site Regular
Site Regular

PSL Awards : N/A
Posts : 32

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum