Просмотр исходного кода

T20L8071 #comment 在CMAKE中定义 WIN32_LEAN_AND_MEAN 宏,对针对此造成的影响在源码中添加适当的头文件引用

gifur 5 лет назад
Родитель
Сommit
d92191b3ec

+ 6 - 0
CMakeLists.txt

@@ -214,6 +214,12 @@ if(WIN32)
 	set(RC_VERSION_DESCRIPTION "${RVC_VERSION_FULL} ${CPACK_SYSTEM_NAME}")
 endif(WIN32)
 
+if(WIN32)
+	add_definitions(-D_CRT_SECURE_NO_WARNINGS)
+	add_definitions(-DWIN32_LEAN_AND_MEAN)
+	add_definitions(-D_WINSOCK_DEPRECATED_NO_WARNINGS)
+endif(WIN32)
+
 # Include files
 check_include_files(fcntl.h HAVE_FCNTL_H)
 check_include_files(unistd.h HAVE_UNISTD_H)

+ 1 - 0
Common/CodeSignVerify.h

@@ -1,6 +1,7 @@
 #pragma once
 #include "SpBase.h"
 #include "SimpleString.h"
+#include <wincrypt.h>
 
 struct CVersionInfo
 {

+ 1 - 0
Common/SpBase.h

@@ -19,6 +19,7 @@
 #endif // __cplusplus
 
 #include <time.h> // for time_t
+#include<wtypes.h>
 
 #if defined(__cplusplus)
 

+ 2 - 0
Common/precompile.h

@@ -12,7 +12,9 @@
 #endif
 
 #include <WinSock2.h>
+#ifndef WIN32_LEAN_AND_MEAN
 #define WIN32_LEAN_AND_MEAN
+#endif //WIN32_LEAN_AND_MEAN
 #include <Mmsystem.h>
 #include <stdlib.h>
 #include <stdio.h>

+ 5 - 1
RVCComm/StdAfx.h

@@ -10,11 +10,15 @@
 #pragma once
 #endif // _MSC_VER > 1000
 
-
+#ifndef _CRT_SECURE_NO_WARNINGS
 #define _CRT_SECURE_NO_WARNINGS
+#endif //_CRT_SECURE_NO_WARNINGS
 
 // Insert your headers here
+#ifndef WIN32_LEAN_AND_MEAN
 #define WIN32_LEAN_AND_MEAN		// Exclude rarely-used stuff from Windows headers
+#endif //WIN32_LEAN_AND_MEAN
+
 #ifndef _WIN32_WINNT
 #define _WIN32_WINNT 0x0520
 #endif

+ 2 - 0
RVCComm/XUnzip.cpp

@@ -95,7 +95,9 @@
 
 
 #define STRICT
+#ifndef WIN32_LEAN_AND_MEAN
 #define WIN32_LEAN_AND_MEAN
+#endif //WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #include <time.h>
 #include <stdio.h>

+ 2 - 0
RVCComm/XZip.cpp

@@ -94,7 +94,9 @@
 
 
 #define STRICT
+#ifndef WIN32_LEAN_AND_MEAN
 #define WIN32_LEAN_AND_MEAN
+#endif //WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #include <tchar.h>
 #include <time.h>

+ 1 - 0
libtoolkit/memutil.h

@@ -4,6 +4,7 @@
 #pragma once
 
 #include "config.h"
+#include <WinSock2.h>
 
 #ifdef __cplusplus
 extern "C" {

+ 2 - 2
libtoolkit/modCheck.h

@@ -4,8 +4,8 @@
 #pragma once
 
 #include "config.h"
-#include<Windows.h>
-//#include <winpr/wtypes.h>
+//#include<Windows.h>
+#include <winpr/wtypes.h>
 
 #ifdef __cplusplus
 extern "C" {

+ 2 - 1
spbase/sp_checkEntity.h

@@ -1,7 +1,8 @@
 #pragma once
 
 #include <stdio.h>
-#include <windows.h>
+//#include <windows.h>
+#include<winpr/windows.h>
 #include <string>
 #include <list>
 

+ 1 - 0
spbase/sp_groupProcess.cpp

@@ -3,6 +3,7 @@
 #include <map>
 #include <string>  
 #include <tlhelp32.h>    //CreateToolhelp32Snapshot
+#include <objbase.h>
 
 using namespace std;
 

+ 1 - 0
spshell/spshell.cpp

@@ -6,6 +6,7 @@
 #include "sp_dbg_export.h"
 #include <DbgHelp.h>
 #include <TlHelp32.h>
+#include <shellapi.h>
 #include "fileutil.h"
 #include "iniutil.h"
 #include "SimpleString.h"

+ 2 - 0
third_party/scew/scew/xerror.c

@@ -76,7 +76,9 @@ scew_error_last_error_ (void)
  * value. However with the current API, this is the best we can do.
  */
 
+#ifndef WIN32_LEAN_AND_MEAN
 #define WIN32_LEAN_AND_MEAN
+#endif //WIN32_LEAN_AND_MEAN
 
 #include <windows.h>
 

+ 5 - 4
winpr/libwinpr/thread/test/TestThreadGetHandle.c

@@ -15,8 +15,8 @@ DWORD g_new_thread_id = 0;
 static DWORD WINAPI thread_func(LPVOID arg)
 {
 	/* exists of the thread the quickest as possible */
-    Sleep(3000);
     g_new_thread_id = GetCurrentThreadId();
+    Sleep(3000);
 	ExitThread(0);
 	return 0;
 }
@@ -24,6 +24,7 @@ static DWORD WINAPI thread_func(LPVOID arg)
 int TestThreadGetHandle(int argc, char* argv[])
 {
     HANDLE thread;
+    HANDLE openThread;
     DWORD waitResult;
     DWORD threadID;
     threadID = 0;
@@ -49,9 +50,9 @@ int TestThreadGetHandle(int argc, char* argv[])
         fprintf(stderr,  "global thread id %d does not equals with returned thread id %d", g_new_thread_id, threadID);
         return -1;
     }
-
-    if(thread != OpenThread(0, FALSE, threadID)) {
-        fprintf(stderr, "open thread and get handle is not the same as before returned one!");
+    openThread = OpenThread(THREAD_ALL_ACCESS, FALSE, threadID);
+    if(NULL == openThread) {
+        fprintf(stderr, "open thread and get handle is null!");
         return -1;
     }
     return 0;