[Snippet] Detecting Operating System. [Also C++ Lessons?]

Posts 1–10 of 10 · Page 1 of 1
[Snippet] Detecting Operating System. [Also C++ Lessons?]
Had a bit of trouble finding this out for myself simply because Ive never done it before. But MSDN was more than helpful. This is my easier to understand version I guess and I hope it helps some of y'all out. As you know it was on one of my injectors and I got a few PMs asking how I did it so here it is.

Code:
    
//Operating System Detection
    OSVERSIONINFO OS;
    ZeroMemory(&OS, sizeof(OSVERSIONINFO));
    OS.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
    GetVersionEx(&OS);

    if (OS.dwMajorVersion == 6 && OS.dwMinorVersion == 1) {
    Log->Lines->Add(”Windows 7 Detected”);
    }
    if (OS.dwMajorVersion == 6 && OS.dwMinorVersion == 0) {
    Log->Lines->Add(”Windows Vista Detected”);
    }
    if (OS.dwMajorVersion == 5) {
    Log->Lines->Add(”Windows XP Detected”);
    }
Also, if you wanted to get the name of the current user logged on:

//Get Computer Information
Code:
TCHAR sUserName[UNLEN + 1];
TCHAR sCompName[MAX_COMPUTERNAME_LENGTH + 1];
DWORD dwUserName = sizeof(sUserName);
DWORD dwCompName = sizeof(sCompName);
GetUserName(sUserName, &dwUserName);
GetComputerName(sCompName, &dwCompName);

How many of you guys would be interested in starting a set of classes geared towards teaching the average users the basics of C++? I was thinking bout hosting sessions
coool :P Faith told me to comment o i did XD
Quote Originally Posted by Faith View Post

How many of you guys would be interested in starting a set of classes geared towards teaching the average users the basics of C++? I was thinking bout hosting sessions
Ummmm... there's plenty of resources out there. Hell someguy made a hundred video tutorials, but if you want to go for it. I am always a proponent of raising public awareness.

Oh and almost forgot. Thanks for the tip. I will remember this, I might have to use it someday.
Reading the registry for the OS is cool too. Buh I guess I won't be using this code any time soon because I'm a VB.Net(er).
I guess your right, but I kind of need something to do to keep me occupied. Plus live help is better than a video that wont help you with the specific problems you may have.
sure that sounds fun =).

How many of you guys would be interested in starting a set of classes geared towards teaching the average users the basics of C++? I was thinking bout hosting sessions


hmm im interested
im interested, good idea!
Posts 1–10 of 10 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

Talk with us