| 1 | /* $Id: directory.cpp,v 1.2 1999-05-31 22:08:11 phaller Exp $ */
|
|---|
| 2 |
|
|---|
| 3 | /*
|
|---|
| 4 | *
|
|---|
| 5 | * Project Odin Software License can be found in LICENSE.TXT
|
|---|
| 6 | *
|
|---|
| 7 | */
|
|---|
| 8 | /*
|
|---|
| 9 | * Win32 Directory functions for OS/2
|
|---|
| 10 | *
|
|---|
| 11 | * Copyright 1998 Sander van Leeuwen
|
|---|
| 12 | *
|
|---|
| 13 | */
|
|---|
| 14 | #include <os2win.h>
|
|---|
| 15 | #include <stdlib.h>
|
|---|
| 16 | #include "unicode.h"
|
|---|
| 17 | #include "misc.h"
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 | //******************************************************************************
|
|---|
| 21 | //******************************************************************************
|
|---|
| 22 | UINT WIN32API GetCurrentDirectoryA(UINT arg1, LPSTR arg2)
|
|---|
| 23 | {
|
|---|
| 24 | dprintf(("KERNEL32: GetCurrentDirectory\n"));
|
|---|
| 25 | return O32_GetCurrentDirectory(arg1, arg2);
|
|---|
| 26 | }
|
|---|
| 27 | //******************************************************************************
|
|---|
| 28 | //******************************************************************************
|
|---|
| 29 | UINT WIN32API GetCurrentDirectoryW(UINT nBufferLength, LPWSTR lpBuffer)
|
|---|
| 30 | {
|
|---|
| 31 | char *asciidir = (char *)malloc(nBufferLength+1);
|
|---|
| 32 | int rc;
|
|---|
| 33 |
|
|---|
| 34 | dprintf(("KERNEL32: OS2GetCurrentDirectoryW\n"));
|
|---|
| 35 |
|
|---|
| 36 | rc = O32_GetCurrentDirectory(nBufferLength, asciidir);
|
|---|
| 37 | if(rc != 0) {
|
|---|
| 38 | AsciiToUnicode(asciidir, lpBuffer);
|
|---|
| 39 | }
|
|---|
| 40 | free(asciidir);
|
|---|
| 41 | return(rc);
|
|---|
| 42 | }
|
|---|
| 43 | //******************************************************************************
|
|---|
| 44 |
|
|---|
| 45 | //******************************************************************************
|
|---|
| 46 | BOOL WIN32API SetCurrentDirectoryA(LPCSTR arg1)
|
|---|
| 47 | {
|
|---|
| 48 | dprintf(("KERNEL32: SetCurrentDirectory to %s\n", arg1));
|
|---|
| 49 | return O32_SetCurrentDirectory((LPSTR)arg1);
|
|---|
| 50 | }
|
|---|
| 51 | //******************************************************************************
|
|---|
| 52 | //******************************************************************************
|
|---|
| 53 | BOOL WIN32API SetCurrentDirectoryW(LPCWSTR lpPathName)
|
|---|
| 54 | {
|
|---|
| 55 | char *asciipath;
|
|---|
| 56 | BOOL rc;
|
|---|
| 57 |
|
|---|
| 58 | dprintf(("KERNEL32: OS2SetCurrentDirectoryW\n"));
|
|---|
| 59 | asciipath = UnicodeToAsciiString((LPWSTR)lpPathName);
|
|---|
| 60 | rc = O32_SetCurrentDirectory(asciipath);
|
|---|
| 61 | FreeAsciiString(asciipath);
|
|---|
| 62 | return(rc);
|
|---|
| 63 | }
|
|---|
| 64 | //******************************************************************************
|
|---|
| 65 | //******************************************************************************
|
|---|
| 66 | BOOL WIN32API CreateDirectoryA( LPCSTR arg1, PSECURITY_ATTRIBUTES arg2)
|
|---|
| 67 | {
|
|---|
| 68 | dprintf(("KERNEL32: OS2CreateDirectoryA %s\n", arg1));
|
|---|
| 69 | return O32_CreateDirectory(arg1, arg2);
|
|---|
| 70 | }
|
|---|
| 71 | //******************************************************************************
|
|---|
| 72 | //******************************************************************************
|
|---|
| 73 | BOOL WIN32API CreateDirectoryW(LPCWSTR arg1, PSECURITY_ATTRIBUTES arg2)
|
|---|
| 74 | {
|
|---|
| 75 | BOOL rc;
|
|---|
| 76 | char *astring;
|
|---|
| 77 |
|
|---|
| 78 | dprintf(("KERNEL32: OS2CreateDirectoryW"));
|
|---|
| 79 | astring = UnicodeToAsciiString((LPWSTR)arg1);
|
|---|
| 80 | rc = O32_CreateDirectory(astring, arg2);
|
|---|
| 81 | FreeAsciiString(astring);
|
|---|
| 82 | return(rc);
|
|---|
| 83 | }
|
|---|
| 84 | //******************************************************************************
|
|---|
| 85 | //******************************************************************************
|
|---|
| 86 | UINT WIN32API GetSystemDirectoryA(LPSTR arg1, UINT arg2)
|
|---|
| 87 | {
|
|---|
| 88 | dprintf(("KERNEL32: GetSystemDirectory\n"));
|
|---|
| 89 | return O32_GetSystemDirectory(arg1, arg2);
|
|---|
| 90 | }
|
|---|
| 91 | //******************************************************************************
|
|---|
| 92 | //******************************************************************************
|
|---|
| 93 | UINT WIN32API GetSystemDirectoryW(LPWSTR lpBuffer, UINT uSize)
|
|---|
| 94 | {
|
|---|
| 95 | char *asciibuffer = (char *)malloc(uSize+1);
|
|---|
| 96 | UINT rc;
|
|---|
| 97 |
|
|---|
| 98 | dprintf(("KERNEL32: OS2GetSystemDirectoryW\n"));
|
|---|
| 99 | rc = O32_GetSystemDirectory(asciibuffer, uSize);
|
|---|
| 100 | if(rc) AsciiToUnicode(asciibuffer, lpBuffer);
|
|---|
| 101 | free(asciibuffer);
|
|---|
| 102 | return(rc);
|
|---|
| 103 | }
|
|---|
| 104 | //******************************************************************************
|
|---|
| 105 | //******************************************************************************
|
|---|
| 106 | UINT WIN32API GetWindowsDirectoryA( LPSTR arg1, UINT arg2)
|
|---|
| 107 | {
|
|---|
| 108 | dprintf(("KERNEL32: GetWindowsDirectory\n"));
|
|---|
| 109 | return O32_GetWindowsDirectory(arg1, arg2);
|
|---|
| 110 | }
|
|---|
| 111 | //******************************************************************************
|
|---|
| 112 | //******************************************************************************
|
|---|
| 113 | UINT WIN32API GetWindowsDirectoryW(LPWSTR lpBuffer, UINT uSize)
|
|---|
| 114 | {
|
|---|
| 115 | char *asciibuffer = (char *)malloc(uSize+1);
|
|---|
| 116 | UINT rc;
|
|---|
| 117 |
|
|---|
| 118 | dprintf(("KERNEL32: OS2GetWindowsDirectoryW"));
|
|---|
| 119 | rc = O32_GetWindowsDirectory(asciibuffer, uSize);
|
|---|
| 120 | AsciiToUnicode(asciibuffer, lpBuffer);
|
|---|
| 121 | free(asciibuffer);
|
|---|
| 122 | return(rc);
|
|---|
| 123 | }
|
|---|
| 124 | //******************************************************************************
|
|---|
| 125 | //******************************************************************************
|
|---|
| 126 | BOOL WIN32API RemoveDirectoryA( LPCSTR arg1)
|
|---|
| 127 | {
|
|---|
| 128 | dprintf(("KERNEL32: OS2RemoveDirectoryA\n"));
|
|---|
| 129 | return O32_RemoveDirectory(arg1);
|
|---|
| 130 | }
|
|---|
| 131 | //******************************************************************************
|
|---|
| 132 | //******************************************************************************
|
|---|
| 133 | BOOL WIN32API RemoveDirectoryW(LPCWSTR lpPathName)
|
|---|
| 134 | {
|
|---|
| 135 | char *asciipath;
|
|---|
| 136 | BOOL rc;
|
|---|
| 137 |
|
|---|
| 138 | dprintf(("KERNEL32: OS2RemoveDirectoryW"));
|
|---|
| 139 | asciipath = UnicodeToAsciiString((LPWSTR)lpPathName);
|
|---|
| 140 | rc = O32_RemoveDirectory(asciipath);
|
|---|
| 141 | FreeAsciiString(asciipath);
|
|---|
| 142 | return(rc);
|
|---|
| 143 | }
|
|---|