add win32_throw_error function
This commit is contained in:
		
							parent
							
								
									9e79ac3d83
								
							
						
					
					
						commit
						73eed8b1c7
					
				@ -21,13 +21,18 @@ void win32_throw_exception(JNIEnv *env, char *msg)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void win32_throw_last_error(JNIEnv *env)
 | 
			
		||||
{
 | 
			
		||||
    win32_throw_error(env, GetLastError());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void win32_throw_error(JNIEnv *env, LONG err)
 | 
			
		||||
{
 | 
			
		||||
    char msg[8192];
 | 
			
		||||
 | 
			
		||||
    FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM |
 | 
			
		||||
                  FORMAT_MESSAGE_IGNORE_INSERTS,
 | 
			
		||||
                  NULL,
 | 
			
		||||
                  GetLastError(),
 | 
			
		||||
                  err,
 | 
			
		||||
                  0, /* default language */
 | 
			
		||||
                  (LPTSTR)msg,
 | 
			
		||||
                  (DWORD)sizeof(msg),
 | 
			
		||||
 | 
			
		||||
@ -28,6 +28,8 @@ extern "C" {
 | 
			
		||||
#endif
 | 
			
		||||
    void win32_throw_exception(JNIEnv *env, char *msg);
 | 
			
		||||
 | 
			
		||||
    void win32_throw_error(JNIEnv *env, LONG err);
 | 
			
		||||
 | 
			
		||||
    void win32_throw_last_error(JNIEnv *env);
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user