Win32OperatingSystem.st
changeset 23534 ec2221eaada0
parent 23533 8a3603bb73d7
child 23636 b9e5840e2c22
equal deleted inserted replaced
23533:8a3603bb73d7 23534:ec2221eaada0
   822 OSVersion(int* pMajor, int* pMinor) {
   822 OSVersion(int* pMajor, int* pMinor) {
   823     static int verMinor, verMajor;
   823     static int verMinor, verMajor;
   824     static int haveVersion = 0;
   824     static int haveVersion = 0;
   825     static char *system = "unknown";
   825     static char *system = "unknown";
   826 
   826 
   827 console_printf(">OSVersion\n");
   827     // console_printf(">OSVersion\n");
   828     if (! haveVersion) {
   828     if (! haveVersion) {
   829 	int winVer;
   829 	int winVer;
   830 	DWORD vsn;
   830 	DWORD vsn;
   831 
   831 
   832 	vsn = GetVersion();
   832 	vsn = GetVersion();
   843 		    system = "vista";
   843 		    system = "vista";
   844 		    if (verMinor >= 1) {
   844 		    if (verMinor >= 1) {
   845 			system = "win7";
   845 			system = "win7";
   846 			if (verMinor >= 2) {
   846 			if (verMinor >= 2) {
   847 			    system = "win8";
   847 			    system = "win8";
   848 			    console_printf(">win8\n");
   848 			    // console_printf(">win8\n");
   849 			    {
   849 			    {
   850 				static HINSTANCE libHandle = NULL;
   850 				static HINSTANCE libHandle = NULL;
   851 
   851 
   852 				FARPROC RtlGetVersion = __get_functionAddress(&libHandle, "ntdll.DLL", "RtlGetVersion");
   852 				FARPROC RtlGetVersion = __get_functionAddress(&libHandle, "ntdll.DLL", "RtlGetVersion");
   853 				OSVERSIONINFOEXW osInfo;
   853 				OSVERSIONINFOEXW osInfo;
   866 					    }
   866 					    }
   867 					}
   867 					}
   868 				    }
   868 				    }
   869 				}
   869 				}
   870 			    }
   870 			    }
   871 			    console_printf("<win8\n");
   871 			    // console_printf("<win8\n");
   872 			}
   872 			}
   873 		    }
   873 		    }
   874 		}
   874 		}
   875 	    } else {
   875 	    } else {
   876 		system = "nt";
   876 		system = "nt";
   877 	    }
   877 	    }
   878 	}
   878 	}
   879 	haveVersion = 1;
   879 	haveVersion = 1;
   880     }
   880     }
   881 console_printf("<OSVersion %s\n", system);
   881     // console_printf("<OSVersion %s\n", system);
   882     *pMajor = verMajor;
   882     *pMajor = verMajor;
   883     *pMinor = verMinor;
   883     *pMinor = verMinor;
   884     return system;
   884     return system;
   885 }
   885 }
   886 
   886 
  9517 	    sys = @symbol(nt);
  9517 	    sys = @symbol(nt);
  9518 	}
  9518 	}
  9519     }
  9519     }
  9520 #if 1
  9520 #if 1
  9521     if (isWin8) {
  9521     if (isWin8) {
  9522 	console_printf(">>OSVersion\n");
  9522 	// console_printf(">>OSVersion\n");
  9523 	s = OSVersion(&verMajor, &verMinor);
  9523 	s = OSVersion(&verMajor, &verMinor);
  9524 	sys = __MKSYMBOL(s, (OBJ *)0);
  9524 	sys = __MKSYMBOL(s, (OBJ *)0);
  9525 	console_printf("<<OSVersion\n");
  9525 	// console_printf("<<OSVersion\n");
  9526     }
  9526     }
  9527 #endif
  9527 #endif
  9528     len = snprintf(vsnBuffer, sizeof(vsnBuffer), "%d.%d", verMajor, verMinor);
  9528     len = snprintf(vsnBuffer, sizeof(vsnBuffer), "%d.%d", verMajor, verMinor);
  9529     rel = __MKSTRING_L(vsnBuffer, len);
  9529     rel = __MKSTRING_L(vsnBuffer, len);
  9530 
  9530