2018. 2. 23. 09:28

Using XP_MODE in an Windows OS other than Windows 7

Using XP_MODE in an Windows OS other than Windows 7


How to add an XP Mode Virtual Machine to Windows 10 (or 8) using Hyper-V

Get official Windows XP virtual machine for Hyper-V

2013. 11. 7. 13:37

run Hyper-V on VMWare

1. install Windows 8 on VMWare

2. check "Virtualize Intel VT-x/EPT or AMD-V/RVI" item ( VMware setting / Processors  )

3. add hypervisor.cpuid.v0 = "FALSE" item in .vmx


2013. 10. 22. 19:45

How to determine physical machine

Using system manufacture name

CMD : SYSTEMINFO

WMI 

http://msdn.microsoft.com/en-us/library/windows/desktop/aa389762%28v=vs.85%29.aspx

http://msdn.microsoft.com/en-us/library/windows/desktop/aa390418%28v=vs.85%29.aspx

Registry

http://www.rohitab.com/discuss/topic/35915-win32-api-to-get-system-information/


#include <windows.h>
#include <commctrl.h>
#include <shlwapi.h>
 
 
UINT GetComputerManufacturer(LPSTR lpBuffer, UINT uSize)
{
    HKEY   hkData;
    HANDLE hHeap;
    LPSTR  lpString = NULL;
    LPBYTE lpData   = NULL;
    DWORD  dwType = 0, dwSize = 0;
    UINT   uIndex, uStart, uEnd, uString, uLength, uState = 0;
    LONG   lErr;
     
    if((lErr = RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("SYSTEM\\CurrentControlSet\\Services\\mssmbios\\Data"),
        0, KEY_QUERY_VALUE, &hkData)) != ERROR_SUCCESS){
        SetLastError(lErr);
        return 0;
    }
    if((lErr = RegQueryValueEx(hkData, TEXT("SMBiosData"), NULL, &dwType, NULL, &dwSize)) == ERROR_SUCCESS){
        if(dwSize == 0 || dwType != REG_BINARY) lErr = ERROR_BADKEY;
        else{
            hHeap = GetProcessHeap();
            lpData = (LPBYTE)HeapAlloc(hHeap, 0, dwSize);
            if(!lpData) lErr = ERROR_NOT_ENOUGH_MEMORY;
            else lErr = RegQueryValueEx(hkData, TEXT("SMBiosData"),
                NULL, NULL, lpData, &dwSize);
        }
    }
    RegCloseKey(hkData);
     
    if(lErr == ERROR_SUCCESS){
        uIndex  = 8 + *(WORD *)(lpData + 6);
        uEnd    = 8 + *(WORD *)(lpData + 4);
        while(lpData[uIndex] != 0x7F && uIndex < uEnd){
            uIndex += lpData[(uStart = uIndex) + 1];
            uString = 1;
            do{
                if(lpData[uStart] == 0x01 && uState == 0){
                    if( lpData[uStart + 4] == uString ||
                        lpData[uStart + 5] == uString ||
                        lpData[uStart + 6] == uString){
                        lpString = (LPSTR)(lpData + uIndex);
                        if(!StrCmpI(lpString, "System manufacturer")){
                            lpString = NULL;
                            uState++;
                        }
                    }
                     
                }else if(lpData[uStart] == 0x02 && uState == 1){
                    if( lpData[uStart + 4] == uString ||
                        lpData[uStart + 5] == uString ||
                        lpData[uStart + 6] == uString)
                        lpString = (LPSTR)(lpData + uIndex);
                     
                }else if(lpData[uStart] == 0x03 && uString == 1){
                    switch(lpData[uStart + 5])
                    {
                        default:   lpString = "(Other)";               break;
                        case 0x02: lpString = "(Unknown)";             break;
                        case 0x03: lpString = "(Desktop)";             break;
                        case 0x04: lpString = "(Low Profile Desktop)"; break;
                        case 0x06: lpString = "(Mini Tower)";          break;
                        case 0x07: lpString = "(Tower)";               break;
                        case 0x08: lpString = "(Portable)";            break;
                        case 0x09: lpString = "(Laptop)";              break;
                        case 0x0A: lpString = "(Notebook)";            break;
                        case 0x0E: lpString = "(Sub Notebook)";        break;
                    }
                     
                }
                if(lpString != NULL){
                    uLength = strlen(lpString) + 1;
                    if(uSize > uLength + 1)
                        lpBuffer += wsprintf(lpBuffer, "%s ", lpString);
                    uSize -= uLength;
                    lpString = NULL;
                }
                uString++;
                while(lpData[uIndex++]);
            }while(lpData[uIndex] && uIndex < uEnd);
            uIndex++;
        }
    }
     
    if(lpData)
        HeapFree(hHeap, 0, lpData);
    SetLastError(lErr);
 
    return uSize;
}
 
int APIENTRY WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmdLine, int nShowCmd)
{
    TCHAR szBuffer[128];
    szBuffer[0] = 0;
     
    InitCommonControls();
     
    if(GetComputerManufacturer(szBuffer, 128) < 0)
        wsprintf(szBuffer, "Failed: %d", GetLastError());
 
    MessageBox(HWND_DESKTOP, szBuffer, TEXT("Manufacturer"), MB_OK);
     
    return 0;
}