- Timestamp:
- Dec 14, 2009 2:24:26 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/src/pj/ip_helper_win32.c
r3030 r3033 42 42 #include <pj/string.h> 43 43 44 /* Dealing with Unicode quirks: 45 46 There seems to be a difference with GetProcAddress() API signature between 47 Windows (i.e. Win32) and Windows CE (e.g. Windows Mobile). On Windows, the 48 API is declared as: 49 50 FARPROC GetProcAddress( 51 HMODULE hModule, 52 LPCSTR lpProcName); 53 54 while on Windows CE: 55 56 FARPROC GetProcAddress( 57 HMODULE hModule, 58 LPCWSTR lpProcName); 59 60 Notice the difference with lpProcName argument type. This means that on 61 Windows, even on Unicode Windows, the lpProcName always takes ANSI format, 62 while on Windows CE, the argument follows the UNICODE setting. 63 64 Because of this, we use a different Unicode treatment here than the usual 65 PJ_NATIVE_STRING_IS_UNICODE PJLIB setting (<pj/unicode.h>): 66 - GPA_TEXT macro: convert literal string to platform's native literal 67 string 68 - gpa_char: the platform native character type 69 70 Note that "GPA" and "gpa" are abbreviations for GetProcAddress. 71 */ 72 #if defined(PJ_WIN32_WINCE) && PJ_WIN32_WINCE!=0 73 /* on CE, follow the PJLIB Unicode setting */ 74 # define GPA_TEXT(x) PJ_T(x) 75 # define gpa_char pj_char_t 76 #else 77 /* on non-CE, always use ANSI format */ 78 # define GPA_TEXT(x) x 79 # define gpa_char char 80 #endif 81 82 44 83 typedef DWORD (WINAPI *PFN_GetIpAddrTable)(PMIB_IPADDRTABLE pIpAddrTable, 45 84 PULONG pdwSize, … … 72 111 } 73 112 74 static FARPROC GetIpHlpApiProc( char *lpProcName)113 static FARPROC GetIpHlpApiProc(gpa_char *lpProcName) 75 114 { 76 115 if(NULL == s_hDLL) { … … 93 132 if(NULL == s_pfnGetIpAddrTable) { 94 133 s_pfnGetIpAddrTable = (PFN_GetIpAddrTable) 95 GetIpHlpApiProc( "GetIpAddrTable");134 GetIpHlpApiProc(GPA_TEXT("GetIpAddrTable")); 96 135 } 97 136 … … 111 150 if(NULL == s_pfnGetAdapterAddresses) { 112 151 s_pfnGetAdapterAddresses = (PFN_GetAdapterAddresses) 113 GetIpHlpApiProc( "GetAdaptersAddresses");152 GetIpHlpApiProc(GPA_TEXT("GetAdaptersAddresses")); 114 153 } 115 154 … … 127 166 if(NULL == s_pfnGetIfEntry) { 128 167 s_pfnGetIfEntry = (PFN_GetIfEntry) 129 GetIpHlpApiProc( "GetIfEntry");168 GetIpHlpApiProc(GPA_TEXT("GetIfEntry")); 130 169 } 131 170 … … 145 184 if(NULL == s_pfnGetIpForwardTable) { 146 185 s_pfnGetIpForwardTable = (PFN_GetIpForwardTable) 147 GetIpHlpApiProc( "GetIpForwardTable");186 GetIpHlpApiProc(GPA_TEXT("GetIpForwardTable")); 148 187 } 149 188
Note: See TracChangeset
for help on using the changeset viewer.