mirror of
				https://github.com/pbatard/rufus.git
				synced 2024-08-14 23:57:05 +00:00 
			
		
		
		
	[msvc] this commit is required for a multithreaded program to work with CRT in Visual C++
Signed-off-by: germanaizek <GermanAizek@yandex.ru>
This commit is contained in:
		
							parent
							
								
									3407d3d5f4
								
							
						
					
					
						commit
						c284f8f333
					
				
					 9 changed files with 126 additions and 3 deletions
				
			
		|  | @ -1134,7 +1134,11 @@ DWORD WINAPI SumThread(void* param) | ||||||
| 	int num_checksums = CHECKSUM_MAX - (enable_extra_hashes ? 0 : 1); | 	int num_checksums = CHECKSUM_MAX - (enable_extra_hashes ? 0 : 1); | ||||||
| 
 | 
 | ||||||
| 	if ((image_path == NULL) || (thread_affinity == NULL)) | 	if ((image_path == NULL) || (thread_affinity == NULL)) | ||||||
|  | #if _MSC_VER && !__INTEL_COMPILER | ||||||
|  | 		_endthreadex(r); | ||||||
|  | #else | ||||||
| 		ExitThread(r); | 		ExitThread(r); | ||||||
|  | #endif | ||||||
| 
 | 
 | ||||||
| 	uprintf("\r\nComputing checksum for '%s'...", image_path); | 	uprintf("\r\nComputing checksum for '%s'...", image_path); | ||||||
| 
 | 
 | ||||||
|  | @ -1155,7 +1159,11 @@ DWORD WINAPI SumThread(void* param) | ||||||
| 			uprintf("Unable to create checksum thread event: %s", WindowsErrorString()); | 			uprintf("Unable to create checksum thread event: %s", WindowsErrorString()); | ||||||
| 			goto out; | 			goto out; | ||||||
| 		} | 		} | ||||||
|  | #if _MSC_VER && !__INTEL_COMPILER | ||||||
|  | 		sum_thread[i] = (HANDLE)_beginthreadex(NULL, 0, &IndividualSumThread, (LPVOID)(uintptr_t)i, 0, NULL); | ||||||
|  | #else | ||||||
| 		sum_thread[i] = CreateThread(NULL, 0, IndividualSumThread, (LPVOID)(uintptr_t)i, 0, NULL); | 		sum_thread[i] = CreateThread(NULL, 0, IndividualSumThread, (LPVOID)(uintptr_t)i, 0, NULL); | ||||||
|  | #endif | ||||||
| 		if (sum_thread[i] == NULL) { | 		if (sum_thread[i] == NULL) { | ||||||
| 			uprintf("Unable to start checksum thread #%d", i); | 			uprintf("Unable to start checksum thread #%d", i); | ||||||
| 			goto out; | 			goto out; | ||||||
|  | @ -1250,7 +1258,11 @@ out: | ||||||
| 	PostMessage(hMainDialog, UM_FORMAT_COMPLETED, (WPARAM)FALSE, 0); | 	PostMessage(hMainDialog, UM_FORMAT_COMPLETED, (WPARAM)FALSE, 0); | ||||||
| 	if (r == 0) | 	if (r == 0) | ||||||
| 		MyDialogBox(hMainInstance, IDD_CHECKSUM, hMainDialog, ChecksumCallback); | 		MyDialogBox(hMainInstance, IDD_CHECKSUM, hMainDialog, ChecksumCallback); | ||||||
|  | #if _MSC_VER && !__INTEL_COMPILER | ||||||
|  | 	_endthreadex(r); | ||||||
|  | #else | ||||||
| 	ExitThread(r); | 	ExitThread(r); | ||||||
|  | #endif | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /*
 | /*
 | ||||||
|  |  | ||||||
|  | @ -2419,7 +2419,11 @@ out: | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	PostMessage(hMainDialog, UM_FORMAT_COMPLETED, (WPARAM)TRUE, 0); | 	PostMessage(hMainDialog, UM_FORMAT_COMPLETED, (WPARAM)TRUE, 0); | ||||||
|  | #if _MSC_VER && !__INTEL_COMPILER | ||||||
|  | 	_endthreadex(0); | ||||||
|  | #else | ||||||
| 	ExitThread(0); | 	ExitThread(0); | ||||||
|  | #endif | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| DWORD WINAPI SaveImageThread(void* param) | DWORD WINAPI SaveImageThread(void* param) | ||||||
|  | @ -2542,5 +2546,9 @@ out: | ||||||
| 	safe_closehandle(hDestImage); | 	safe_closehandle(hDestImage); | ||||||
| 	safe_unlockclose(hPhysicalDrive); | 	safe_unlockclose(hPhysicalDrive); | ||||||
| 	PostMessage(hMainDialog, UM_FORMAT_COMPLETED, (WPARAM)TRUE, 0); | 	PostMessage(hMainDialog, UM_FORMAT_COMPLETED, (WPARAM)TRUE, 0); | ||||||
|  | #if _MSC_VER && !__INTEL_COMPILER | ||||||
|  | 	_endthreadex(0); | ||||||
|  | #else | ||||||
| 	ExitThread(0); | 	ExitThread(0); | ||||||
|  | #endif | ||||||
| } | } | ||||||
|  |  | ||||||
							
								
								
									
										28
									
								
								src/net.c
									
										
									
									
									
								
							
							
						
						
									
										28
									
								
								src/net.c
									
										
									
									
									
								
							|  | @ -594,7 +594,11 @@ typedef struct { | ||||||
| static DWORD WINAPI DownloadSignedFileThread(LPVOID param) | static DWORD WINAPI DownloadSignedFileThread(LPVOID param) | ||||||
| { | { | ||||||
| 	DownloadSignedFileThreadArgs* args = (DownloadSignedFileThreadArgs*)param; | 	DownloadSignedFileThreadArgs* args = (DownloadSignedFileThreadArgs*)param; | ||||||
|  | #if _MSC_VER && !__INTEL_COMPILER | ||||||
|  | 	_endthreadex(DownloadSignedFile(args->url, args->file, args->hProgressDialog, args->bPromptOnError)); | ||||||
|  | #else | ||||||
| 	ExitThread(DownloadSignedFile(args->url, args->file, args->hProgressDialog, args->bPromptOnError)); | 	ExitThread(DownloadSignedFile(args->url, args->file, args->hProgressDialog, args->bPromptOnError)); | ||||||
|  | #endif | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| HANDLE DownloadSignedFileThreaded(const char* url, const char* file, HWND hProgressDialog, BOOL bPromptOnError) | HANDLE DownloadSignedFileThreaded(const char* url, const char* file, HWND hProgressDialog, BOOL bPromptOnError) | ||||||
|  | @ -604,7 +608,11 @@ HANDLE DownloadSignedFileThreaded(const char* url, const char* file, HWND hProgr | ||||||
| 	args.file = file; | 	args.file = file; | ||||||
| 	args.hProgressDialog = hProgressDialog; | 	args.hProgressDialog = hProgressDialog; | ||||||
| 	args.bPromptOnError = bPromptOnError; | 	args.bPromptOnError = bPromptOnError; | ||||||
|  | #if _MSC_VER && !__INTEL_COMPILER | ||||||
|  | 	return (HANDLE)_beginthreadex(NULL, 0, &DownloadSignedFileThread, &args, 0, NULL); | ||||||
|  | #else | ||||||
| 	return CreateThread(NULL, 0, DownloadSignedFileThread, &args, 0, NULL); | 	return CreateThread(NULL, 0, DownloadSignedFileThread, &args, 0, NULL); | ||||||
|  | #endif | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static __inline uint64_t to_uint64_t(uint16_t x[4]) { | static __inline uint64_t to_uint64_t(uint16_t x[4]) { | ||||||
|  | @ -865,7 +873,11 @@ out: | ||||||
| 	force_update_check = FALSE; | 	force_update_check = FALSE; | ||||||
| 	update_check_thread = NULL; | 	update_check_thread = NULL; | ||||||
| 	CoUninitialize(); | 	CoUninitialize(); | ||||||
|  | #if _MSC_VER && !__INTEL_COMPILER | ||||||
|  | 	_endthreadex(0); | ||||||
|  | #else | ||||||
| 	ExitThread(0); | 	ExitThread(0); | ||||||
|  | #endif | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /*
 | /*
 | ||||||
|  | @ -877,7 +889,11 @@ BOOL CheckForUpdates(BOOL force) | ||||||
| 	if (update_check_thread != NULL) | 	if (update_check_thread != NULL) | ||||||
| 		return FALSE; | 		return FALSE; | ||||||
| 
 | 
 | ||||||
|  | #if _MSC_VER && !__INTEL_COMPILER | ||||||
|  | 	update_check_thread = (HANDLE)_beginthreadex(NULL, 0, &CheckForUpdatesThread, NULL, 0, NULL); | ||||||
|  | #else | ||||||
| 	update_check_thread = CreateThread(NULL, 0, CheckForUpdatesThread, NULL, 0, NULL); | 	update_check_thread = CreateThread(NULL, 0, CheckForUpdatesThread, NULL, 0, NULL); | ||||||
|  | #endif | ||||||
| 	if (update_check_thread == NULL) { | 	if (update_check_thread == NULL) { | ||||||
| 		uprintf("Unable to start update check thread"); | 		uprintf("Unable to start update check thread"); | ||||||
| 		return FALSE; | 		return FALSE; | ||||||
|  | @ -1071,12 +1087,22 @@ out: | ||||||
| 	SendMessage(hMainDialog, UM_ENABLE_CONTROLS, 0, 0); | 	SendMessage(hMainDialog, UM_ENABLE_CONTROLS, 0, 0); | ||||||
| 	dialog_showing--; | 	dialog_showing--; | ||||||
| 	CoUninitialize(); | 	CoUninitialize(); | ||||||
|  | #if _MSC_VER && !__INTEL_COMPILER | ||||||
|  | 	_endthreadex(dwExitCode); | ||||||
|  | #else | ||||||
| 	ExitThread(dwExitCode); | 	ExitThread(dwExitCode); | ||||||
|  | #endif | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| BOOL DownloadISO() | BOOL DownloadISO() | ||||||
| { | { | ||||||
| 	if (CreateThread(NULL, 0, DownloadISOThread, NULL, 0, NULL) == NULL) { | 	HANDLE hDownloadIso; | ||||||
|  | #if _MSC_VER && !__INTEL_COMPILER | ||||||
|  | 	hDownloadIso = (HANDLE)_beginthreadex(NULL, 0, &DownloadISOThread, NULL, 0, NULL); | ||||||
|  | #else | ||||||
|  | 	hDownloadIso = CreateThread(NULL, 0, DownloadISOThread, NULL, 0, NULL); | ||||||
|  | #endif | ||||||
|  | 	if (hDownloadIso == NULL) { | ||||||
| 		uprintf("Unable to start Windows ISO download thread"); | 		uprintf("Unable to start Windows ISO download thread"); | ||||||
| 		FormatStatus = ERROR_SEVERITY_ERROR | FAC(FACILITY_STORAGE) | APPERR(ERROR_CANT_START_THREAD); | 		FormatStatus = ERROR_SEVERITY_ERROR | FAC(FACILITY_STORAGE) | APPERR(ERROR_CANT_START_THREAD); | ||||||
| 		SendMessage(hMainDialog, UM_ENABLE_CONTROLS, 0, 0); | 		SendMessage(hMainDialog, UM_ENABLE_CONTROLS, 0, 0); | ||||||
|  |  | ||||||
|  | @ -641,7 +641,11 @@ out: | ||||||
| 	PhFree(buffer); | 	PhFree(buffer); | ||||||
| 	PhFree(handles); | 	PhFree(handles); | ||||||
| 	PhDestroyHeap(); | 	PhDestroyHeap(); | ||||||
|  | #if _MSC_VER && !__INTEL_COMPILER | ||||||
|  | 	_endthreadex(0); | ||||||
|  | #else | ||||||
| 	ExitThread(0); | 	ExitThread(0); | ||||||
|  | #endif | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /**
 | /**
 | ||||||
|  | @ -669,7 +673,11 @@ BYTE SearchProcess(char* HandleName, DWORD dwTimeOut, BOOL bPartialMatch, BOOL b | ||||||
| 
 | 
 | ||||||
| 	assert(_wHandleName != NULL); | 	assert(_wHandleName != NULL); | ||||||
| 
 | 
 | ||||||
|  | #if _MSC_VER && !__INTEL_COMPILER | ||||||
|  | 	handle = (HANDLE)_beginthreadex(NULL, 0, &SearchProcessThread, NULL, 0, NULL); | ||||||
|  | #else | ||||||
| 	handle = CreateThread(NULL, 0, SearchProcessThread, NULL, 0, NULL); | 	handle = CreateThread(NULL, 0, SearchProcessThread, NULL, 0, NULL); | ||||||
|  | #endif | ||||||
| 	if (handle == NULL) { | 	if (handle == NULL) { | ||||||
| 		uprintf("Warning: Unable to create conflicting process search thread"); | 		uprintf("Warning: Unable to create conflicting process search thread"); | ||||||
| 		goto out; | 		goto out; | ||||||
|  |  | ||||||
							
								
								
									
										40
									
								
								src/rufus.c
									
										
									
									
									
								
							
							
						
						
									
										40
									
								
								src/rufus.c
									
										
									
									
									
								
							|  | @ -1399,7 +1399,11 @@ DWORD WINAPI ImageScanThread(LPVOID param) | ||||||
| out: | out: | ||||||
| 	dont_display_image_name = FALSE; | 	dont_display_image_name = FALSE; | ||||||
| 	PrintInfo(0, MSG_210); | 	PrintInfo(0, MSG_210); | ||||||
|  | #if _MSC_VER && !__INTEL_COMPILER | ||||||
|  | 	_endthreadex(0); | ||||||
|  | #else | ||||||
| 	ExitThread(0); | 	ExitThread(0); | ||||||
|  | #endif | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // Likewise, boot check will block message processing => use a thread
 | // Likewise, boot check will block message processing => use a thread
 | ||||||
|  | @ -1799,7 +1803,11 @@ uefi_target: | ||||||
| 
 | 
 | ||||||
| out: | out: | ||||||
| 	PostMessage(hMainDialog, UM_FORMAT_START, ret, 0); | 	PostMessage(hMainDialog, UM_FORMAT_START, ret, 0); | ||||||
|  | #if _MSC_VER && !__INTEL_COMPILER | ||||||
|  | 	_endthreadex((DWORD)ret); | ||||||
|  | #else | ||||||
| 	ExitThread((DWORD)ret); | 	ExitThread((DWORD)ret); | ||||||
|  | #endif | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static __inline const char* IsAlphaOrBeta(void) | static __inline const char* IsAlphaOrBeta(void) | ||||||
|  | @ -2047,7 +2055,11 @@ static void SaveVHD(void) | ||||||
| 			EnableControls(FALSE, FALSE); | 			EnableControls(FALSE, FALSE); | ||||||
| 			FormatStatus = 0; | 			FormatStatus = 0; | ||||||
| 			InitProgress(TRUE); | 			InitProgress(TRUE); | ||||||
|  | #if _MSC_VER && !__INTEL_COMPILER | ||||||
|  | 			format_thread = (HANDLE)_beginthreadex(NULL, 0, &SaveImageThread, &img_save, 0, NULL); | ||||||
|  | #else | ||||||
| 			format_thread = CreateThread(NULL, 0, SaveImageThread, &img_save, 0, NULL); | 			format_thread = CreateThread(NULL, 0, SaveImageThread, &img_save, 0, NULL); | ||||||
|  | #endif | ||||||
| 			if (format_thread != NULL) { | 			if (format_thread != NULL) { | ||||||
| 				uprintf("\r\nSave to VHD operation started"); | 				uprintf("\r\nSave to VHD operation started"); | ||||||
| 				PrintInfo(0, -1); | 				PrintInfo(0, -1); | ||||||
|  | @ -2102,7 +2114,11 @@ static void SaveISO(void) | ||||||
| 	// Disable all controls except cancel
 | 	// Disable all controls except cancel
 | ||||||
| 	EnableControls(FALSE, FALSE); | 	EnableControls(FALSE, FALSE); | ||||||
| 	InitProgress(TRUE); | 	InitProgress(TRUE); | ||||||
|  | #if _MSC_VER && !__INTEL_COMPILER | ||||||
|  | 	format_thread = (HANDLE)_beginthreadex(NULL, 0, &SaveImageThread, &img_save, 0, NULL); | ||||||
|  | #else | ||||||
| 	format_thread = CreateThread(NULL, 0, SaveImageThread, &img_save, 0, NULL); | 	format_thread = CreateThread(NULL, 0, SaveImageThread, &img_save, 0, NULL); | ||||||
|  | #endif | ||||||
| 	if (format_thread != NULL) { | 	if (format_thread != NULL) { | ||||||
| 		uprintf("\r\nSave to ISO operation started"); | 		uprintf("\r\nSave to ISO operation started"); | ||||||
| 		PrintInfo(0, -1); | 		PrintInfo(0, -1); | ||||||
|  | @ -2584,7 +2600,13 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA | ||||||
| 					} | 					} | ||||||
| 				} | 				} | ||||||
| 				FormatStatus = 0; | 				FormatStatus = 0; | ||||||
| 				if (CreateThread(NULL, 0, ImageScanThread, NULL, 0, NULL) == NULL) { | 				HANDLE hImgScanThread; | ||||||
|  | #if _MSC_VER && !__INTEL_COMPILER | ||||||
|  | 				hImgScanThread = (HANDLE)_beginthreadex(NULL, 0, &ImageScanThread, NULL, 0, NULL); | ||||||
|  | #else | ||||||
|  | 				hImgScanThread = CreateThread(NULL, 0, ImageScanThread, NULL, 0, NULL); | ||||||
|  | #endif | ||||||
|  | 				if (hImgScanThread == NULL) { | ||||||
| 					uprintf("Unable to start ISO scanning thread"); | 					uprintf("Unable to start ISO scanning thread"); | ||||||
| 					FormatStatus = ERROR_SEVERITY_ERROR | FAC(FACILITY_STORAGE) | APPERR(ERROR_CANT_START_THREAD); | 					FormatStatus = ERROR_SEVERITY_ERROR | FAC(FACILITY_STORAGE) | APPERR(ERROR_CANT_START_THREAD); | ||||||
| 				} | 				} | ||||||
|  | @ -2621,7 +2643,13 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA | ||||||
| 			selection_default = (int)ComboBox_GetCurItemData(hBootType); | 			selection_default = (int)ComboBox_GetCurItemData(hBootType); | ||||||
| 			// Create a thread to validate options and download files as needed (so that we can update the UI).
 | 			// Create a thread to validate options and download files as needed (so that we can update the UI).
 | ||||||
| 			// On exit, this thread sends message UM_FORMAT_START back to this dialog.
 | 			// On exit, this thread sends message UM_FORMAT_START back to this dialog.
 | ||||||
| 			if (CreateThread(NULL, 0, BootCheckThread, NULL, 0, NULL) == NULL) { | 			HANDLE hBootCheck; | ||||||
|  | #if _MSC_VER && !__INTEL_COMPILER | ||||||
|  | 			hBootCheck = (HANDLE)_beginthreadex(NULL, 0, &BootCheckThread, NULL, 0, NULL); | ||||||
|  | #else | ||||||
|  | 			hBootCheck = CreateThread(NULL, 0, BootCheckThread, NULL, 0, NULL); | ||||||
|  | #endif | ||||||
|  | 			if (hBootCheck == NULL) { | ||||||
| 				uprintf("Unable to start boot check thread"); | 				uprintf("Unable to start boot check thread"); | ||||||
| 				FormatStatus = ERROR_SEVERITY_ERROR | FAC(FACILITY_STORAGE) | APPERR(ERROR_CANT_START_THREAD); | 				FormatStatus = ERROR_SEVERITY_ERROR | FAC(FACILITY_STORAGE) | APPERR(ERROR_CANT_START_THREAD); | ||||||
| 				PostMessage(hMainDialog, UM_FORMAT_COMPLETED, (WPARAM)FALSE, 0); | 				PostMessage(hMainDialog, UM_FORMAT_COMPLETED, (WPARAM)FALSE, 0); | ||||||
|  | @ -2646,7 +2674,11 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA | ||||||
| 				EnableControls(FALSE, FALSE); | 				EnableControls(FALSE, FALSE); | ||||||
| 				InitProgress(FALSE); | 				InitProgress(FALSE); | ||||||
| 				SetThreadAffinity(thread_affinity, CHECKSUM_MAX + 1); | 				SetThreadAffinity(thread_affinity, CHECKSUM_MAX + 1); | ||||||
|  | #if _MSC_VER && !__INTEL_COMPILER | ||||||
|  | 				format_thread = (HANDLE)_beginthreadex(NULL, 0, &SumThread, (LPVOID)thread_affinity, 0, NULL); | ||||||
|  | #else | ||||||
| 				format_thread = CreateThread(NULL, 0, SumThread, (LPVOID)thread_affinity, 0, NULL); | 				format_thread = CreateThread(NULL, 0, SumThread, (LPVOID)thread_affinity, 0, NULL); | ||||||
|  | #endif | ||||||
| 				if (format_thread != NULL) { | 				if (format_thread != NULL) { | ||||||
| 					SetThreadPriority(format_thread, default_thread_priority); | 					SetThreadPriority(format_thread, default_thread_priority); | ||||||
| 					PrintInfo(0, -1); | 					PrintInfo(0, -1); | ||||||
|  | @ -3025,7 +3057,11 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA | ||||||
| 		nDeviceIndex = ComboBox_GetCurSel(hDeviceList); | 		nDeviceIndex = ComboBox_GetCurSel(hDeviceList); | ||||||
| 		DeviceNum = (DWORD)ComboBox_GetItemData(hDeviceList, nDeviceIndex); | 		DeviceNum = (DWORD)ComboBox_GetItemData(hDeviceList, nDeviceIndex); | ||||||
| 		InitProgress(zero_drive || write_as_image); | 		InitProgress(zero_drive || write_as_image); | ||||||
|  | #if _MSC_VER && !__INTEL_COMPILER | ||||||
|  | 		format_thread = (HANDLE)_beginthreadex(NULL, 0, &FormatThread, (LPVOID)(uintptr_t)DeviceNum, 0, NULL); | ||||||
|  | #else | ||||||
| 		format_thread = CreateThread(NULL, 0, FormatThread, (LPVOID)(uintptr_t)DeviceNum, 0, NULL); | 		format_thread = CreateThread(NULL, 0, FormatThread, (LPVOID)(uintptr_t)DeviceNum, 0, NULL); | ||||||
|  | #endif | ||||||
| 		if (format_thread == NULL) { | 		if (format_thread == NULL) { | ||||||
| 			uprintf("Unable to start formatting thread"); | 			uprintf("Unable to start formatting thread"); | ||||||
| 			FormatStatus = ERROR_SEVERITY_ERROR | FAC(FACILITY_STORAGE) | APPERR(ERROR_CANT_START_THREAD); | 			FormatStatus = ERROR_SEVERITY_ERROR | FAC(FACILITY_STORAGE) | APPERR(ERROR_CANT_START_THREAD); | ||||||
|  |  | ||||||
|  | @ -20,6 +20,7 @@ | ||||||
| #include <inttypes.h> | #include <inttypes.h> | ||||||
| 
 | 
 | ||||||
| #if defined(_MSC_VER) | #if defined(_MSC_VER) | ||||||
|  | #include <process.h> | ||||||
| // Disable some VS Code Analysis warnings
 | // Disable some VS Code Analysis warnings
 | ||||||
| #pragma warning(disable: 4996)		// Ignore deprecated
 | #pragma warning(disable: 4996)		// Ignore deprecated
 | ||||||
| #pragma warning(disable: 6258)		// I know what I'm using TerminateThread for
 | #pragma warning(disable: 6258)		// I know what I'm using TerminateThread for
 | ||||||
|  |  | ||||||
|  | @ -927,7 +927,11 @@ BOOL SetLGP(BOOL bRestore, BOOL* bExistingKey, const char* szPath, const char* s | ||||||
| 		return FALSE; | 		return FALSE; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | #if _MSC_VER && !__INTEL_COMPILER | ||||||
|  | 	thread_id = (HANDLE)_beginthreadex(NULL, 0, &SetLGPThread, (LPVOID)¶ms, 0, NULL); | ||||||
|  | #else | ||||||
| 	thread_id = CreateThread(NULL, 0, SetLGPThread, (LPVOID)¶ms, 0, NULL); | 	thread_id = CreateThread(NULL, 0, SetLGPThread, (LPVOID)¶ms, 0, NULL); | ||||||
|  | #endif | ||||||
| 	if (thread_id == NULL) { | 	if (thread_id == NULL) { | ||||||
| 		ubprintf("SetLGP: Unable to start thread"); | 		ubprintf("SetLGP: Unable to start thread"); | ||||||
| 		return FALSE; | 		return FALSE; | ||||||
|  |  | ||||||
|  | @ -1574,7 +1574,11 @@ void SetFidoCheck(void) | ||||||
| 		return; | 		return; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | #if _MSC_VER && !__INTEL_COMPILER | ||||||
|  | 	_beginthreadex(NULL, 0, &CheckForFidoThread, NULL, 0, NULL); | ||||||
|  | #else | ||||||
| 	CreateThread(NULL, 0, CheckForFidoThread, NULL, 0, NULL); | 	CreateThread(NULL, 0, CheckForFidoThread, NULL, 0, NULL); | ||||||
|  | #endif | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /*
 | /*
 | ||||||
|  |  | ||||||
							
								
								
									
										24
									
								
								src/vhd.c
									
										
									
									
									
								
							
							
						
						
									
										24
									
								
								src/vhd.c
									
										
									
									
									
								
							|  | @ -567,7 +567,11 @@ static DWORD WINAPI WimMountImageThread(LPVOID param) | ||||||
| out: | out: | ||||||
| 	wfree(temp_dir); | 	wfree(temp_dir); | ||||||
| 	safe_free(wimage); | 	safe_free(wimage); | ||||||
|  | #if _MSC_VER && !__INTEL_COMPILER | ||||||
|  | 	_endthreadex((DWORD)r); | ||||||
|  | #else | ||||||
| 	ExitThread((DWORD)r); | 	ExitThread((DWORD)r); | ||||||
|  | #endif | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // Returns the temporary mount path on success, NULL on error.
 | // Returns the temporary mount path on success, NULL on error.
 | ||||||
|  | @ -578,7 +582,11 @@ char* WimMountImage(const char* image, int index) | ||||||
| 	_image = image; | 	_image = image; | ||||||
| 	_index = index; | 	_index = index; | ||||||
| 
 | 
 | ||||||
|  | #if _MSC_VER && !__INTEL_COMPILER | ||||||
|  | 	wim_thread = (HANDLE)_beginthreadex(NULL, 0, &WimMountImageThread, NULL, 0, NULL); | ||||||
|  | #else | ||||||
| 	wim_thread = CreateThread(NULL, 0, WimMountImageThread, NULL, 0, NULL); | 	wim_thread = CreateThread(NULL, 0, WimMountImageThread, NULL, 0, NULL); | ||||||
|  | #endif | ||||||
| 	if (wim_thread == NULL) { | 	if (wim_thread == NULL) { | ||||||
| 		uprintf("Unable to start mount-image thread"); | 		uprintf("Unable to start mount-image thread"); | ||||||
| 		return NULL; | 		return NULL; | ||||||
|  | @ -630,7 +638,11 @@ static DWORD WINAPI WimUnmountImageThread(LPVOID param) | ||||||
| 	wmount_path[0] = 0; | 	wmount_path[0] = 0; | ||||||
| out: | out: | ||||||
| 	safe_free(wimage); | 	safe_free(wimage); | ||||||
|  | #if _MSC_VER && !__INTEL_COMPILER | ||||||
|  | 	_endthreadex((DWORD)r); | ||||||
|  | #else | ||||||
| 	ExitThread((DWORD)r); | 	ExitThread((DWORD)r); | ||||||
|  | #endif | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| BOOL WimUnmountImage(const char* image, int index) | BOOL WimUnmountImage(const char* image, int index) | ||||||
|  | @ -639,7 +651,11 @@ BOOL WimUnmountImage(const char* image, int index) | ||||||
| 	_image = image; | 	_image = image; | ||||||
| 	_index = index; | 	_index = index; | ||||||
| 
 | 
 | ||||||
|  | #if _MSC_VER && !__INTEL_COMPILER | ||||||
|  | 	wim_thread = (HANDLE)_beginthreadex(NULL, 0, &WimUnmountImageThread, NULL, 0, NULL); | ||||||
|  | #else | ||||||
| 	wim_thread = CreateThread(NULL, 0, WimUnmountImageThread, NULL, 0, NULL); | 	wim_thread = CreateThread(NULL, 0, WimUnmountImageThread, NULL, 0, NULL); | ||||||
|  | #endif | ||||||
| 	if (wim_thread == NULL) { | 	if (wim_thread == NULL) { | ||||||
| 		uprintf("Unable to start unmount-image thread"); | 		uprintf("Unable to start unmount-image thread"); | ||||||
| 		return FALSE; | 		return FALSE; | ||||||
|  | @ -905,7 +921,11 @@ out: | ||||||
| 		pfWIMUnregisterMessageCallback(NULL, (FARPROC)WimProgressCallback); | 		pfWIMUnregisterMessageCallback(NULL, (FARPROC)WimProgressCallback); | ||||||
| 	safe_free(wimage); | 	safe_free(wimage); | ||||||
| 	safe_free(wdst); | 	safe_free(wdst); | ||||||
|  | #if _MSC_VER && !__INTEL_COMPILER | ||||||
|  | 	_endthreadex((DWORD)r); | ||||||
|  | #else | ||||||
| 	ExitThread((DWORD)r); | 	ExitThread((DWORD)r); | ||||||
|  | #endif | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| BOOL WimApplyImage(const char* image, int index, const char* dst) | BOOL WimApplyImage(const char* image, int index, const char* dst) | ||||||
|  | @ -915,7 +935,11 @@ BOOL WimApplyImage(const char* image, int index, const char* dst) | ||||||
| 	_index = index; | 	_index = index; | ||||||
| 	_dst = dst; | 	_dst = dst; | ||||||
| 
 | 
 | ||||||
|  | #if _MSC_VER && !__INTEL_COMPILER | ||||||
|  | 	wim_thread = (HANDLE)_beginthreadex(NULL, 0, &WimApplyImageThread, NULL, 0, NULL); | ||||||
|  | #else | ||||||
| 	wim_thread = CreateThread(NULL, 0, WimApplyImageThread, NULL, 0, NULL); | 	wim_thread = CreateThread(NULL, 0, WimApplyImageThread, NULL, 0, NULL); | ||||||
|  | #endif | ||||||
| 	if (wim_thread == NULL) { | 	if (wim_thread == NULL) { | ||||||
| 		uprintf("Unable to start apply-image thread"); | 		uprintf("Unable to start apply-image thread"); | ||||||
| 		return FALSE; | 		return FALSE; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue