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