| 1 | /* $Id: directory.cpp,v 1.4 1999-06-10 20:47:58 phaller Exp $ */
|
|---|
| 2 |
|
|---|
| 3 | /*
|
|---|
| 4 | * Win32 Directory functions for OS/2
|
|---|
| 5 | *
|
|---|
| 6 | * Copyright 1998 Sander van Leeuwen
|
|---|
| 7 | *
|
|---|
| 8 | *
|
|---|
| 9 | * Project Odin Software License can be found in LICENSE.TXT
|
|---|
| 10 | *
|
|---|
| 11 | */
|
|---|
| 12 | #include <os2win.h>
|
|---|
| 13 | #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"));
|
|---|
| 85 | return O32_GetSystemDirectory(arg1, arg2);
|
|---|
| 86 | }
|
|---|
| 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 | }
|
|---|