Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenprecomp.h
Go to the documentation of this file.
00001 /* 00002 * COPYRIGHT: See COPYING in the top level directory 00003 * PROJECT: ReactOS System Libraries 00004 * FILE: lib/dnsapi/precomp.h 00005 * PURPOSE: Win32 DNS API Libary Header 00006 * PROGRAMMER: Alex Ionescu (alex@relsoft.net) 00007 */ 00008 00009 /* INCLUDES ******************************************************************/ 00010 00011 #define WIN32_NO_STATUS 00012 #define NTOS_MODE_USER 00013 00014 /* PSDK/NDK Headers */ 00015 #include <windows.h> 00016 #include <winerror.h> 00017 #include <windns.h> 00018 #include <ndk/rtlfuncs.h> 00019 00020 /* Internal DNSAPI Headers */ 00021 #include <internal/windns.h> 00022 00023 static inline LPWSTR dns_strdup_uw( const char *str ) 00024 { 00025 LPWSTR ret = NULL; 00026 if (str) 00027 { 00028 DWORD len = MultiByteToWideChar( CP_UTF8, 0, str, -1, NULL, 0 ); 00029 if ((ret = HeapAlloc(GetProcessHeap(),0,( len * sizeof(WCHAR) )))) 00030 MultiByteToWideChar( CP_UTF8, 0, str, -1, ret, len ); 00031 } 00032 return ret; 00033 } 00034 00035 static inline LPWSTR dns_strdup_aw( LPCSTR str ) 00036 { 00037 LPWSTR ret = NULL; 00038 if (str) 00039 { 00040 DWORD len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 ); 00041 if ((ret = HeapAlloc(GetProcessHeap(), 0, ( len * sizeof(WCHAR) )))) 00042 MultiByteToWideChar( CP_ACP, 0, str, -1, ret, len ); 00043 } 00044 return ret; 00045 } 00046 00047 static inline LPSTR dns_strdup_a( LPCSTR src ) 00048 { 00049 LPSTR dst; 00050 00051 if (!src) return NULL; 00052 dst = HeapAlloc(GetProcessHeap(), 0, (lstrlenA( src ) + 1) * sizeof(char) ); 00053 if (dst) lstrcpyA( dst, src ); 00054 return dst; 00055 } 00056 00057 static inline char *dns_strdup_u( const char *src ) 00058 { 00059 char *dst; 00060 00061 if (!src) return NULL; 00062 dst = HeapAlloc(GetProcessHeap(), 0, (strlen( src ) + 1) * sizeof(char) ); 00063 if (dst) strcpy( dst, src ); 00064 return dst; 00065 } 00066 00067 static inline LPWSTR dns_strdup_w( LPCWSTR src ) 00068 { 00069 LPWSTR dst; 00070 00071 if (!src) return NULL; 00072 dst = HeapAlloc(GetProcessHeap(), 0, (lstrlenW( src ) + 1) * sizeof(WCHAR) ); 00073 if (dst) lstrcpyW( dst, src ); 00074 return dst; 00075 } 00076 00077 static inline LPSTR dns_strdup_wa( LPCWSTR str ) 00078 { 00079 LPSTR ret = NULL; 00080 if (str) 00081 { 00082 DWORD len = WideCharToMultiByte( CP_ACP, 0, str, -1, NULL, 0, NULL, NULL ); 00083 if ((ret = HeapAlloc(GetProcessHeap(), 0, len ))) 00084 WideCharToMultiByte( CP_ACP, 0, str, -1, ret, len, NULL, NULL ); 00085 } 00086 return ret; 00087 } 00088 00089 static inline char *dns_strdup_wu( LPCWSTR str ) 00090 { 00091 LPSTR ret = NULL; 00092 if (str) 00093 { 00094 DWORD len = WideCharToMultiByte( CP_UTF8, 0, str, -1, NULL, 0, NULL, NULL ); 00095 if ((ret = HeapAlloc(GetProcessHeap(), 0, len ))) 00096 WideCharToMultiByte( CP_UTF8, 0, str, -1, ret, len, NULL, NULL ); 00097 } 00098 return ret; 00099 } 00100 00101 static inline char *dns_strdup_au( LPCSTR src ) 00102 { 00103 char *dst = NULL; 00104 LPWSTR ret = dns_strdup_aw( src ); 00105 00106 if (ret) 00107 { 00108 dst = dns_strdup_wu( ret ); 00109 HeapFree( GetProcessHeap(), 0, ret ); 00110 } 00111 return dst; 00112 } 00113 00114 static inline LPSTR dns_strdup_ua( const char *src ) 00115 { 00116 LPSTR dst = NULL; 00117 LPWSTR ret = dns_strdup_uw( src ); 00118 00119 if (ret) 00120 { 00121 dst = dns_strdup_wa( ret ); 00122 HeapFree( GetProcessHeap(), 0, ret ); 00123 } 00124 return dst; 00125 } Generated on Fri May 25 2012 04:14:47 for ReactOS by
1.7.6.1
|