- Timestamp:
- Sep 7, 2000, 11:40:28 PM (25 years ago)
- Location:
- trunk/src/kernel32
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/environ.cpp
r3512 r4208 1 /* $Id: environ.cpp,v 1. 4 2000-05-10 13:13:32 sandervlExp $ */1 /* $Id: environ.cpp,v 1.5 2000-09-07 21:40:28 phaller Exp $ */ 2 2 3 3 /* … … 17 17 * 18 18 */ 19 20 /***************************************************************************** 21 * Includes * 22 *****************************************************************************/ 23 19 24 #include <odin.h> 20 25 #include <odinwrap.h> … … 33 38 #include "dbglocal.h" 34 39 35 //****************************************************************************** 36 //****************************************************************************** 37 LPSTR WIN32API GetEnvironmentStringsA(void) 38 { 39 dprintf(("KERNEL32: OS2GetEnvironmentStringsA\n")); 40 return (LPSTR) O32_GetEnvironmentStrings(); 41 } 42 //****************************************************************************** 43 //****************************************************************************** 44 LPWSTR WIN32API GetEnvironmentStringsW(VOID) 40 /***************************************************************************** 41 * Defines * 42 *****************************************************************************/ 43 44 ODINDEBUGCHANNEL(KERNEL32-ENVIRONMENT) 45 46 47 //****************************************************************************** 48 //****************************************************************************** 49 ODINFUNCTION0(LPSTR, GetEnvironmentStringsA) 50 { 51 return (LPSTR) O32_GetEnvironmentStrings(); 52 } 53 //****************************************************************************** 54 //****************************************************************************** 55 ODINFUNCTION0(LPWSTR, GetEnvironmentStringsW) 45 56 { 46 57 char *envstrings = (char *)O32_GetEnvironmentStrings(); … … 48 59 LPWSTR wenvstrings; 49 60 int len, i; 50 51 dprintf(("KERNEL32: GetEnvironmentStringsW\n"));52 61 53 62 if(envstrings == NULL) … … 73 82 //****************************************************************************** 74 83 //****************************************************************************** 75 BOOL WIN32API FreeEnvironmentStringsA(LPSTR envstrings) 76 { 77 dprintf(("KERNEL32: FreeEnvironmentStringsA\n")); 84 ODINFUNCTION1(BOOL, FreeEnvironmentStringsA, 85 LPSTR, envstrings) 86 { 87 dprintf(("not correctly implemented.\n")); 88 //free(envstrings); 78 89 return(TRUE); 79 90 } 80 91 //****************************************************************************** 81 92 //****************************************************************************** 82 BOOL WIN32API FreeEnvironmentStringsW(LPWSTR envstrings) 83 { 84 dprintf(("KERNEL32: FreeEnvironmentStringsW\n")); 85 free(envstrings); 93 ODINFUNCTION1(BOOL, FreeEnvironmentStringsW, 94 LPWSTR, envstrings) 95 { 96 dprintf(("not correctly implemented.\n")); 97 //free(envstrings); 86 98 return(TRUE); 87 99 } 88 100 //****************************************************************************** 89 101 //****************************************************************************** 90 BOOL WIN32API SetEnvironmentVariableA(LPCSTR arg1, LPCSTR arg2) 91 { 92 dprintf(("KERNEL32: SetEnvironmentVariable %s to %s\n", arg1, arg2)); 93 return O32_SetEnvironmentVariable(arg1, arg2); 94 } 95 //****************************************************************************** 96 //****************************************************************************** 97 BOOL WIN32API SetEnvironmentVariableW(LPCWSTR lpName, LPCWSTR lpValue) 98 { 99 char *asciiname, *asciivalue; 100 BOOL rc; 101 102 dprintf(("KERNEL32: OS2SetEnvironmentVariableW\n")); 103 asciiname = UnicodeToAsciiString((LPWSTR)lpName); 104 asciivalue = UnicodeToAsciiString((LPWSTR)lpValue); 105 rc = O32_SetEnvironmentVariable(asciiname, asciivalue); 106 FreeAsciiString(asciivalue); 107 FreeAsciiString(asciiname); 108 return(rc); 109 } 110 //****************************************************************************** 111 //****************************************************************************** 112 DWORD WIN32API GetEnvironmentVariableA(LPCSTR arg1, LPSTR arg2, DWORD arg3) 113 { 114 dprintf(("KERNEL32: GetEnvironmentVariable %s\n", arg1)); 115 return O32_GetEnvironmentVariable(arg1, arg2, arg3); 116 } 117 //****************************************************************************** 118 //****************************************************************************** 119 DWORD WIN32API GetEnvironmentVariableW(LPCWSTR lpName, LPWSTR lpBuffer, 120 DWORD nSize) 102 ODINFUNCTION2(BOOL, SetEnvironmentVariableA, 103 LPCSTR, lpszName, 104 LPCSTR, lpszValue) 105 { 106 return O32_SetEnvironmentVariable(lpszName, lpszValue); 107 } 108 //****************************************************************************** 109 //****************************************************************************** 110 ODINFUNCTION2(BOOL, SetEnvironmentVariableW, 111 LPCWSTR, lpszName, 112 LPCWSTR, lpszValue) 113 { 114 char *asciiname, *asciivalue; 115 BOOL rc; 116 117 asciiname = UnicodeToAsciiString((LPWSTR)lpszName); 118 asciivalue = UnicodeToAsciiString((LPWSTR)lpszValue); 119 rc = O32_SetEnvironmentVariable(asciiname, asciivalue); 120 FreeAsciiString(asciivalue); 121 FreeAsciiString(asciiname); 122 return(rc); 123 } 124 //****************************************************************************** 125 //****************************************************************************** 126 ODINFUNCTION3(DWORD, GetEnvironmentVariableA, 127 LPCSTR, lpName, 128 LPSTR, lpBuffer, 129 DWORD, nSize) 130 { 131 return O32_GetEnvironmentVariable(lpName, lpBuffer, nSize); 132 } 133 //****************************************************************************** 134 //****************************************************************************** 135 ODINFUNCTION3(DWORD, GetEnvironmentVariableW, 136 LPCWSTR, lpName, 137 LPWSTR, lpBuffer, 138 DWORD, nSize) 121 139 { 122 140 char *astring, *asciibuffer; 123 141 DWORD rc; 124 142 125 dprintf(("KERNEL32: OS2GetEnvironmentVariableW\n")); 126 asciibuffer = (char *)malloc(nSize+1); 127 *asciibuffer = 0; 128 astring = UnicodeToAsciiString((LPWSTR)lpName); 129 130 rc = O32_GetEnvironmentVariable(astring, asciibuffer, nSize); 131 AsciiToUnicode(asciibuffer, lpBuffer); 132 FreeAsciiString(astring); 133 free(asciibuffer); 134 return(rc); 143 asciibuffer = (char *)malloc(nSize+1); 144 *asciibuffer = 0; 145 astring = UnicodeToAsciiString((LPWSTR)lpName); 146 147 rc = O32_GetEnvironmentVariable(astring, asciibuffer, nSize); 148 AsciiToUnicode(asciibuffer, lpBuffer); 149 FreeAsciiString(astring); 150 free(asciibuffer); 151 return(rc); 135 152 } 136 153 /*********************************************************************** … … 169 186 *****************************************************************************/ 170 187 171 DWORD WIN32API ExpandEnvironmentStringsA( LPCSTR src, LPSTR dst, DWORD count ) 188 ODINFUNCTION3(DWORD, ExpandEnvironmentStringsA, 189 LPCSTR, lpSrc, 190 LPSTR, lpDst, 191 DWORD, nSize) 172 192 { 173 193 DWORD len, total_size = 1; /* 1 for terminating '\0' */ 174 194 LPCSTR p, var; 175 195 176 dprintf(("KERNEL32:ExpandEnvironmentStringsA '%s', %08x, %08x", 177 src, dst, count 178 )); 179 180 if (!count) dst = NULL; 181 182 while (*src) 183 { 184 if (*src != '%') 196 if (!nSize) lpDst = NULL; 197 198 while (*lpSrc) 199 { 200 if (*lpSrc != '%') 185 201 { 186 if ((p = strchr( src, '%' ))) len = p - src;187 else len = strlen( src);188 var = src;189 src += len;202 if ((p = strchr( lpSrc, '%' ))) len = p - lpSrc; 203 else len = strlen(lpSrc); 204 var = lpSrc; 205 lpSrc += len; 190 206 } 191 207 else /* we are at the start of a variable */ 192 208 { 193 if ((p = strchr( src + 1, '%' )))209 if ((p = strchr( lpSrc + 1, '%' ))) 194 210 { 195 len = p - src - 1; /* Length of the variable name */211 len = p - lpSrc - 1; /* Length of the variable name */ 196 212 if ((var = ENV_FindVariable( GetEnvironmentStringsA(), 197 src + 1, len )))213 lpSrc + 1, len ))) 198 214 { 199 src += len + 2; /* Skip the variable name */215 lpSrc += len + 2; /* Skip the variable name */ 200 216 len = strlen(var); 201 217 } 202 218 else 203 219 { 204 var = src; /* Copy original name instead */220 var = lpSrc; /* Copy original name instead */ 205 221 len += 2; 206 src += len;222 lpSrc += len; 207 223 } 208 224 } 209 225 else /* unfinished variable name, ignore it */ 210 226 { 211 var = src;212 len = strlen( src); /* Copy whole string */213 src += len;227 var = lpSrc; 228 len = strlen(lpSrc); /* Copy whole string */ 229 lpSrc += len; 214 230 } 215 231 } 216 232 total_size += len; 217 if ( dst)233 if (lpDst) 218 234 { 219 if ( count < len) len = count;220 memcpy( dst, var, len );221 dst += len;222 count-= len;235 if (nSize < len) len = nSize; 236 memcpy( lpDst, var, len ); 237 lpDst += len; 238 nSize -= len; 223 239 } 224 240 } 225 241 226 242 /* Null-terminate the string */ 227 if ( dst)228 { 229 if (! count) dst--;230 * dst = '\0';243 if (lpDst) 244 { 245 if (!nSize) lpDst--; 246 *lpDst = '\0'; 231 247 } 232 248 dprintf(("KERNEL32:ExpandEnvironmentStringsA returned %s %d", 233 dst, total_size));249 lpDst, total_size)); 234 250 return total_size; 235 251 } … … 254 270 *****************************************************************************/ 255 271 256 DWORD WIN32API ExpandEnvironmentStringsW(LPCWSTR lpSrc, LPWSTR lpDst, DWORD nSize) 272 ODINFUNCTION3(DWORD, ExpandEnvironmentStringsW, 273 LPCWSTR,lpSrc, 274 LPWSTR, lpDst, 275 DWORD, nSize) 257 276 { 258 277 LPSTR srcA = HEAP_strdupWtoA( GetProcessHeap(), 0, lpSrc ); 259 278 LPSTR dstA = lpDst ? (LPSTR)HeapAlloc( GetProcessHeap(), 0, nSize ) : NULL; 260 279 261 dprintf(("KERNEL32:ExpandEnvironmentStringsW(%08x,%08x,%08x)", lpSrc, lpDst, nSize));262 263 280 DWORD ret = ExpandEnvironmentStringsA( srcA, dstA, nSize ); 264 281 if (dstA) -
trunk/src/kernel32/time.cpp
r4174 r4208 1 /* $Id: time.cpp,v 1. 9 2000-09-03 18:04:56phaller Exp $ */1 /* $Id: time.cpp,v 1.10 2000-09-07 21:40:27 phaller Exp $ */ 2 2 3 3 /* … … 14 14 * Project Odin Software License can be found in LICENSE.TXT 15 15 */ 16 17 18 /***************************************************************************** 19 * Includes * 20 *****************************************************************************/ 21 22 #include <odin.h> 23 #include <odinwrap.h> 24 #include <os2sel.h> 25 16 26 #include <os2win.h> 27 17 28 #include <winnls.h> 18 29 #include "winuser.h" … … 24 35 #define DBG_LOCALLOG DBG_time 25 36 #include "dbglocal.h" 37 38 /***************************************************************************** 39 * Defines * 40 *****************************************************************************/ 41 42 ODINDEBUGCHANNEL(KERNEL32-TIME) 43 44 26 45 27 46 #define lstrcpynAtoW(unicode,ascii,asciilen) AsciiToUnicodeN(ascii,unicode,asciilen); … … 131 150 //****************************************************************************** 132 151 //****************************************************************************** 133 VOID WIN32API GetSystemTime( LPSYSTEMTIME arg1) 134 { 135 dprintf(("KERNEL32: OS2GetSystemTime\n")); 152 ODINPROCEDURE1(GetSystemTime, 153 LPSYSTEMTIME, arg1) 154 { 136 155 O32_GetSystemTime(arg1); 137 156 }
Note:
See TracChangeset
for help on using the changeset viewer.