mirror of
				https://github.com/gnif/LookingGlass.git
				synced 2025-10-31 04:31:57 +00:00 
			
		
		
		
	[host] fix build in VS++
This commit is contained in:
		
							
								
								
									
										17
									
								
								host/Util.h
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								host/Util.h
									
									
									
									
									
								
							| @@ -36,7 +36,14 @@ public: | ||||
|   { | ||||
|     std::string defaultPath; | ||||
|  | ||||
|     const char *libPath = getenv("SystemRoot"); | ||||
| #if __MINGW32__ | ||||
|     const char  * libPath    = getenv("SystemRoot"); | ||||
|     const size_t  libPathLen = strlen(libPath); | ||||
| #else | ||||
|     char  * libPath; | ||||
|     size_t  libPathLen; | ||||
|     _dupenv_s(&libPath, &libPathLen, "SystemRoot"); | ||||
| #endif | ||||
|  | ||||
|     if (!libPath) | ||||
|     { | ||||
| @@ -44,9 +51,12 @@ public: | ||||
|       return defaultPath; | ||||
|     } | ||||
|  | ||||
|     if (!strlen(libPath)) | ||||
|     if (!libPathLen) | ||||
|     { | ||||
|       DEBUG_ERROR("The SystemRoot environment variable is not set"); | ||||
| #ifndef __MINGW32__ | ||||
|       free(libPath); | ||||
| #endif | ||||
|       return defaultPath; | ||||
|     } | ||||
| #ifdef _WIN64 | ||||
| @@ -60,6 +70,9 @@ public: | ||||
|     { | ||||
|       defaultPath = std::string(libPath) + "\\System32"; | ||||
|     } | ||||
| #endif | ||||
| #ifndef __MINGW32__ | ||||
|     free(libPath); | ||||
| #endif | ||||
|     return defaultPath; | ||||
|   } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Geoffrey McRae
					Geoffrey McRae