- Timestamp:
- Sep 28, 1999, 3:18:45 AM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/directory.cpp
r100 r1076 1 /* $Id: directory.cpp,v 1. 4 1999-06-10 20:47:58phaller Exp $ */1 /* $Id: directory.cpp,v 1.5 1999-09-28 01:17:01 phaller Exp $ */ 2 2 3 3 /* … … 10 10 * 11 11 */ 12 13 14 /***************************************************************************** 15 * Includes * 16 *****************************************************************************/ 17 18 #include <odin.h> 19 #include <odinwrap.h> 12 20 #include <os2win.h> 13 21 #include <stdlib.h> 14 #include "unicode.h" 15 16 //****************************************************************************** 17 //****************************************************************************** 18 UINT WIN32API GetCurrentDirectoryA(UINT arg1, LPSTR arg2) 19 { 20 dprintf(("KERNEL32: GetCurrentDirectory\n")); 21 return O32_GetCurrentDirectory(arg1, arg2); 22 } 23 //****************************************************************************** 24 //****************************************************************************** 25 UINT WIN32API GetCurrentDirectoryW(UINT nBufferLength, LPWSTR lpBuffer) 26 { 27 char *asciidir = (char *)malloc(nBufferLength+1); 28 int rc; 29 30 dprintf(("KERNEL32: OS2GetCurrentDirectoryW\n")); 31 32 rc = O32_GetCurrentDirectory(nBufferLength, asciidir); 33 if(rc != 0) { 34 AsciiToUnicode(asciidir, lpBuffer); 35 } 36 free(asciidir); 37 return(rc); 38 } 39 //****************************************************************************** 40 41 //****************************************************************************** 42 BOOL WIN32API SetCurrentDirectoryA(LPCSTR arg1) 43 { 44 dprintf(("KERNEL32: SetCurrentDirectory to %s\n", arg1)); 45 return O32_SetCurrentDirectory((LPSTR)arg1); 46 } 47 //****************************************************************************** 48 //****************************************************************************** 49 BOOL WIN32API SetCurrentDirectoryW(LPCWSTR lpPathName) 50 { 51 char *asciipath; 52 BOOL rc; 53 54 dprintf(("KERNEL32: OS2SetCurrentDirectoryW\n")); 55 asciipath = UnicodeToAsciiString((LPWSTR)lpPathName); 56 rc = O32_SetCurrentDirectory(asciipath); 57 FreeAsciiString(asciipath); 58 return(rc); 59 } 60 //****************************************************************************** 61 //****************************************************************************** 62 BOOL WIN32API CreateDirectoryA( LPCSTR arg1, PSECURITY_ATTRIBUTES arg2) 63 { 64 dprintf(("KERNEL32: OS2CreateDirectoryA %s\n", arg1)); 65 return O32_CreateDirectory(arg1, arg2); 66 } 67 //****************************************************************************** 68 //****************************************************************************** 69 BOOL WIN32API CreateDirectoryW(LPCWSTR arg1, PSECURITY_ATTRIBUTES arg2) 70 { 71 BOOL rc; 72 char *astring; 73 74 dprintf(("KERNEL32: OS2CreateDirectoryW")); 75 astring = UnicodeToAsciiString((LPWSTR)arg1); 76 rc = O32_CreateDirectory(astring, arg2); 77 FreeAsciiString(astring); 78 return(rc); 79 } 80 //****************************************************************************** 81 //****************************************************************************** 82 UINT WIN32API GetSystemDirectoryA(LPSTR arg1, UINT arg2) 83 { 84 dprintf(("KERNEL32: GetSystemDirectory\n")); 22 #include <unicode.h> 23 #include <heapstring.h> 24 25 26 ODINDEBUGCHANNEL(KERNEL32-DIRECTORY) 27 28 29 /***************************************************************************** 30 * Name : GetCurrentDirectoryA 31 * Purpose : query the current directory 32 * Parameters: 33 * Variables : 34 * Result : 35 * Remark : 36 * Status : 37 * 38 * Author : Patrick Haller [Wed, 1999/09/28 20:44] 39 *****************************************************************************/ 40 41 ODINFUNCTION2(UINT, GetCurrentDirectoryA, UINT, nBufferLength, 42 LPSTR, lpBuffer) 43 { 44 return O32_GetCurrentDirectory(nBufferLength, lpBuffer); 45 } 46 47 48 /***************************************************************************** 49 * Name : GetCurrentDirectoryW 50 * Purpose : query the current directory 51 * Parameters: 52 * Variables : 53 * Result : 54 * Remark : 55 * Status : 56 * 57 * Author : Patrick Haller [Wed, 1999/09/28 20:44] 58 *****************************************************************************/ 59 60 ODINFUNCTION2(UINT, GetCurrentDirectoryW, UINT, nBufferLength, 61 LPWSTR, lpBuffer) 62 { 63 char *asciidir = (char *)malloc(nBufferLength+1); 64 int rc; 65 66 rc = O32_GetCurrentDirectory(nBufferLength, asciidir); 67 if(rc != 0) 68 AsciiToUnicode(asciidir, lpBuffer); 69 free(asciidir); 70 return(rc); 71 } 72 73 74 /***************************************************************************** 75 * Name : SetCurrentDirectoryA 76 * Purpose : 77 * Parameters: 78 * Variables : 79 * Result : 80 * Remark : 81 * Status : 82 * 83 * Author : Patrick Haller [Wed, 1999/09/28 20:44] 84 *****************************************************************************/ 85 86 ODINFUNCTION1(BOOL,SetCurrentDirectoryA,LPCSTR,lpPathName) 87 { 88 return O32_SetCurrentDirectory((LPSTR)lpPathName); 89 } 90 91 92 /***************************************************************************** 93 * Name : SetCurrentDirectoryW 94 * Purpose : 95 * Parameters: 96 * Variables : 97 * Result : 98 * Remark : 99 * Status : 100 * 101 * Author : Patrick Haller [Wed, 1999/09/28 20:44] 102 *****************************************************************************/ 103 104 ODINFUNCTION1(BOOL,SetCurrentDirectoryW,LPCWSTR,lpPathName) 105 { 106 char *asciipath; 107 BOOL rc; 108 109 asciipath = UnicodeToAsciiString((LPWSTR)lpPathName); 110 rc = SetCurrentDirectoryA(asciipath); 111 FreeAsciiString(asciipath); 112 return(rc); 113 } 114 115 116 /***************************************************************************** 117 * Name : CreateDirectoryA 118 * Purpose : 119 * Parameters: 120 * Variables : 121 * Result : 122 * Remark : 123 * Status : 124 * 125 * Author : Patrick Haller [Wed, 1999/09/28 20:44] 126 *****************************************************************************/ 127 128 ODINFUNCTION2(BOOL,CreateDirectoryA,LPCSTR, arg1, 129 PSECURITY_ATTRIBUTES,arg2) 130 { 131 return O32_CreateDirectory(arg1, arg2); 132 } 133 134 135 /***************************************************************************** 136 * Name : CreateDirectoryW 137 * Purpose : 138 * Parameters: 139 * Variables : 140 * Result : 141 * Remark : 142 * Status : 143 * 144 * Author : Patrick Haller [Wed, 1999/09/28 20:44] 145 *****************************************************************************/ 146 147 ODINFUNCTION2(BOOL,CreateDirectoryW,LPCWSTR, arg1, 148 PSECURITY_ATTRIBUTES,arg2) 149 { 150 BOOL rc; 151 char *astring; 152 153 astring = UnicodeToAsciiString((LPWSTR)arg1); 154 rc = CreateDirectoryA(astring, arg2); 155 FreeAsciiString(astring); 156 return(rc); 157 } 158 159 160 /***************************************************************************** 161 * Name : GetSystemDirectoryA 162 * Purpose : 163 * Parameters: 164 * Variables : 165 * Result : 166 * Remark : 167 * Status : 168 * 169 * Author : Patrick Haller [Wed, 1999/09/28 20:44] 170 *****************************************************************************/ 171 172 ODINFUNCTION2(UINT,GetSystemDirectoryA,LPSTR,arg1, 173 UINT, arg2) 174 { 175 LPSTR lpstrEnv = getenv("WIN32.DIR.SYSTEM"); /* query environment */ 176 177 if (lpstrEnv != NULL) 178 { 179 lstrcpynA(arg1, /* copy environment variable to buffer */ 180 lpstrEnv, 181 arg2); 182 return (lstrlenA(arg1)); /* return number of copies bytes */ 183 } 184 else 185 /* if no override by environment is available */ 85 186 return O32_GetSystemDirectory(arg1, arg2); 86 187 } 87 //****************************************************************************** 88 //****************************************************************************** 89 UINT WIN32API GetSystemDirectoryW(LPWSTR lpBuffer, UINT uSize) 90 { 91 char *asciibuffer = (char *)malloc(uSize+1); 92 UINT rc; 93 94 dprintf(("KERNEL32: OS2GetSystemDirectoryW\n")); 95 rc = O32_GetSystemDirectory(asciibuffer, uSize); 96 if(rc) AsciiToUnicode(asciibuffer, lpBuffer); 97 free(asciibuffer); 98 return(rc); 99 } 100 //****************************************************************************** 101 //****************************************************************************** 102 UINT WIN32API GetWindowsDirectoryA( LPSTR arg1, UINT arg2) 103 { 104 dprintf(("KERNEL32: GetWindowsDirectory\n")); 105 return O32_GetWindowsDirectory(arg1, arg2); 106 } 107 //****************************************************************************** 108 //****************************************************************************** 109 UINT WIN32API GetWindowsDirectoryW(LPWSTR lpBuffer, UINT uSize) 110 { 111 char *asciibuffer = (char *)malloc(uSize+1); 112 UINT rc; 113 114 dprintf(("KERNEL32: OS2GetWindowsDirectoryW")); 115 rc = O32_GetWindowsDirectory(asciibuffer, uSize); 116 AsciiToUnicode(asciibuffer, lpBuffer); 117 free(asciibuffer); 118 return(rc); 119 } 120 //****************************************************************************** 121 //****************************************************************************** 122 BOOL WIN32API RemoveDirectoryA( LPCSTR arg1) 123 { 124 dprintf(("KERNEL32: OS2RemoveDirectoryA\n")); 125 return O32_RemoveDirectory(arg1); 126 } 127 //****************************************************************************** 128 //****************************************************************************** 129 BOOL WIN32API RemoveDirectoryW(LPCWSTR lpPathName) 130 { 131 char *asciipath; 132 BOOL rc; 133 134 dprintf(("KERNEL32: OS2RemoveDirectoryW")); 135 asciipath = UnicodeToAsciiString((LPWSTR)lpPathName); 136 rc = O32_RemoveDirectory(asciipath); 137 FreeAsciiString(asciipath); 138 return(rc); 139 } 188 189 190 /***************************************************************************** 191 * Name : GetSystemDirectoryW 192 * Purpose : 193 * Parameters: 194 * Variables : 195 * Result : 196 * Remark : 197 * Status : 198 * 199 * Author : Patrick Haller [Wed, 1999/09/28 20:44] 200 *****************************************************************************/ 201 202 ODINFUNCTION2(UINT,GetSystemDirectoryW,LPWSTR,lpBuffer, 203 UINT, uSize) 204 { 205 char *asciibuffer = (char *)malloc(uSize+1); 206 UINT rc; 207 208 rc = GetSystemDirectoryA(asciibuffer, uSize); 209 if(rc) AsciiToUnicode(asciibuffer, lpBuffer); 210 free(asciibuffer); 211 return(rc); 212 } 213 214 215 /***************************************************************************** 216 * Name : GetWindowsDirectoryA 217 * Purpose : 218 * Parameters: 219 * Variables : 220 * Result : 221 * Remark : 222 * Status : 223 * 224 * Author : Patrick Haller [Wed, 1999/09/28 20:44] 225 *****************************************************************************/ 226 227 ODINFUNCTION2(UINT,GetWindowsDirectoryA,LPSTR,arg1, 228 UINT, arg2) 229 { 230 LPSTR lpstrEnv = getenv("WIN32.DIR.WINDOWS"); /* query environment */ 231 232 if (lpstrEnv != NULL) 233 { 234 lstrcpynA(arg1, /* copy environment variable to buffer */ 235 lpstrEnv, 236 arg2); 237 return (lstrlenA(arg1)); /* return number of copies bytes */ 238 } 239 else 240 /* if no override by environment is available */ 241 return O32_GetWindowsDirectory(arg1, 242 arg2); 243 } 244 245 246 /***************************************************************************** 247 * Name : GetWindowsDirectoryW 248 * Purpose : 249 * Parameters: 250 * Variables : 251 * Result : 252 * Remark : 253 * Status : 254 * 255 * Author : Patrick Haller [Wed, 1999/09/28 20:44] 256 *****************************************************************************/ 257 258 ODINFUNCTION2(UINT,GetWindowsDirectoryW,LPWSTR,lpBuffer, 259 UINT, uSize) 260 { 261 char *asciibuffer = (char *)malloc(uSize+1); 262 UINT rc; 263 264 rc = GetWindowsDirectoryA(asciibuffer, uSize); 265 AsciiToUnicode(asciibuffer, lpBuffer); 266 free(asciibuffer); 267 return(rc); 268 } 269 270 271 /***************************************************************************** 272 * Name : RemoveDirectoryA 273 * Purpose : 274 * Parameters: 275 * Variables : 276 * Result : 277 * Remark : 278 * Status : 279 * 280 * Author : Patrick Haller [Wed, 1999/09/28 20:44] 281 *****************************************************************************/ 282 283 ODINFUNCTION1(BOOL,RemoveDirectoryA,LPCSTR,arg1) 284 { 285 return O32_RemoveDirectory(arg1); 286 } 287 288 289 /***************************************************************************** 290 * Name : RemoveDirectoryW 291 * Purpose : 292 * Parameters: 293 * Variables : 294 * Result : 295 * Remark : 296 * Status : 297 * 298 * Author : Patrick Haller [Wed, 1999/09/28 20:44] 299 *****************************************************************************/ 300 301 ODINFUNCTION1(BOOL,RemoveDirectoryW,LPCWSTR,lpPathName) 302 { 303 char *asciipath; 304 BOOL rc; 305 306 asciipath = UnicodeToAsciiString((LPWSTR)lpPathName); 307 rc = RemoveDirectoryA(asciipath); 308 FreeAsciiString(asciipath); 309 return(rc); 310 } 311
Note:
See TracChangeset
for help on using the changeset viewer.