source: trunk/src/kernel32/Fileio.cpp@ 1242

Last change on this file since 1242 was 1242, checked in by sandervl, 26 years ago

EB's GetFullPathNameW fix

File size: 30.7 KB
Line 
1/* $Id: Fileio.cpp,v 1.10 1999-10-10 09:00:57 sandervl Exp $ */
2
3/*
4 * Win32 File IO API functions for OS/2
5 *
6 * Copyright 1998 Sander van Leeuwen
7 * Copyright 1998 Patrick Haller
8 *
9 *
10 * Project Odin Software License can be found in LICENSE.TXT
11 *
12 */
13#include <os2win.h>
14#include <stdlib.h>
15#include <string.h>
16#include "unicode.h"
17#include <heapstring.h>
18#include "handlemanager.h"
19#include "devio.h"
20#include "oslibdos.h"
21
22//******************************************************************************
23//******************************************************************************
24HFILE WIN32API CreateFileA(LPCSTR lpszName,
25 DWORD fdwAccess,
26 DWORD fdwShareMode,
27 LPSECURITY_ATTRIBUTES lpsa,
28 DWORD fdwCreate,
29 DWORD fdwAttrsAndFlags,
30 HANDLE hTemplateFile)
31{
32 HANDLE rc;
33
34 dprintf(("KERNEL32: CreateFileA(%s,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh)\n",
35 lpszName,
36 fdwAccess,
37 fdwShareMode,
38 lpsa,
39 fdwCreate,
40 fdwAttrsAndFlags,
41 hTemplateFile));
42
43 rc = HMCreateFile(lpszName,
44 fdwAccess,
45 fdwShareMode,
46 lpsa,
47 fdwCreate,
48 fdwAttrsAndFlags,
49 hTemplateFile);
50
51 return(rc);
52}
53//******************************************************************************
54//******************************************************************************
55HFILE WIN32API CreateFileW(LPCWSTR arg1,
56 DWORD arg2,
57 DWORD arg3,
58 PSECURITY_ATTRIBUTES arg4,
59 DWORD arg5,
60 DWORD arg6,
61 HANDLE arg7)
62{
63 HANDLE rc;
64 char *astring;
65
66 dprintf(("KERNEL32: CreateFileW"));
67 astring = UnicodeToAsciiString((LPWSTR)arg1);
68 rc = CreateFileA(astring, arg2, arg3, arg4, arg5, arg6, arg7);
69 FreeAsciiString(astring);
70 return(rc);
71}
72//******************************************************************************
73//******************************************************************************
74HANDLE WIN32API FindFirstFileA(LPCSTR arg1, WIN32_FIND_DATAA * arg2)
75{
76 dprintf(("KERNEL32: FindFirstFile(%s,%08xh)\n",
77 arg1,
78 arg2));
79
80 return O32_FindFirstFile(arg1, arg2);
81}
82//******************************************************************************
83//******************************************************************************
84HANDLE WIN32API FindFirstFileW(LPCWSTR arg1, WIN32_FIND_DATAW * arg2)
85{
86 HANDLE rc;
87 char *astring;
88 WIN32_FIND_DATAA wfda;
89
90 dprintf(("KERNEL32: FindFirstFileW(%08xh, %08xh)",
91 arg1,
92 arg2));
93
94 astring = UnicodeToAsciiString((LPWSTR)arg1);
95 rc = FindFirstFileA(astring, &wfda);
96
97 // convert back the result structure
98 memcpy(arg2,
99 &wfda,
100 sizeof(WIN32_FIND_DATAA));
101
102 lstrcpynAtoW (arg2->cFileName,
103 wfda.cFileName,
104 sizeof(wfda.cFileName));
105
106 lstrcpynAtoW (arg2->cAlternateFileName,
107 wfda.cAlternateFileName,
108 sizeof(wfda.cAlternateFileName));
109
110 FreeAsciiString(astring);
111 return(rc);
112}
113//******************************************************************************
114//******************************************************************************
115BOOL WIN32API FindNextFileA(HANDLE arg1, WIN32_FIND_DATAA * arg2)
116{
117 dprintf(("KERNEL32: FindNextFile"));
118 return O32_FindNextFile(arg1, arg2);
119}
120//******************************************************************************
121//TODO: convert string in WIN32_FIND_DATAW * structure
122//******************************************************************************
123BOOL WIN32API FindNextFileW(HANDLE arg1, WIN32_FIND_DATAW * arg2)
124{
125 WIN32_FIND_DATAA wfda;
126 BOOL rc;
127
128 dprintf(("KERNEL32: FindNextFileW(%08xh, %08xh)\n",
129 arg1,
130 arg2));
131
132 rc = FindNextFileA(arg1, &wfda);
133
134 // convert back the result structure
135 memcpy(arg2,
136 &wfda,
137 sizeof(WIN32_FIND_DATAA));
138
139 lstrcpynAtoW (arg2->cFileName,
140 wfda.cFileName,
141 sizeof(wfda.cFileName));
142
143 lstrcpynAtoW (arg2->cAlternateFileName,
144 wfda.cAlternateFileName,
145 sizeof(wfda.cAlternateFileName));
146
147 return rc;
148}
149//******************************************************************************
150//******************************************************************************
151BOOL WIN32API FindClose(HANDLE arg1)
152{
153 dprintf(("KERNEL32: FindClose\n"));
154 return O32_FindClose(arg1);
155}
156//******************************************************************************
157//******************************************************************************
158DWORD WIN32API GetFileType(HANDLE hFile)
159{
160 dprintf(("KERNEL32: GetFileType(%08xh)\n",
161 hFile));
162
163 return(HMGetFileType(hFile));
164}
165//******************************************************************************
166//******************************************************************************
167DWORD WIN32API GetFileInformationByHandle(HANDLE arg1,
168 BY_HANDLE_FILE_INFORMATION *arg2)
169{
170 dprintf(("KERNEL32: GetFIleInformationByHandle(%08xh,%0xh)\n",
171 arg1,
172 arg2));
173
174 return(HMGetFileInformationByHandle(arg1,arg2));
175}
176//******************************************************************************
177//******************************************************************************
178BOOL WIN32API SetEndOfFile( HANDLE arg1)
179{
180 dprintf(("KERNEL32: SetEndOfFile(%08xh)\n",
181 arg1));
182
183 return HMSetEndOfFile(arg1);
184}
185//******************************************************************************
186//******************************************************************************
187BOOL WIN32API SetFileTime(HANDLE arg1,
188 const FILETIME *arg2,
189 const FILETIME *arg3,
190 const FILETIME *arg4)
191{
192 dprintf(("KERNEL32: SetFileTime(%08xh,%08xh,%08xh,%08xh)\n",
193 arg1,
194 arg2,
195 arg3,
196 arg4));
197
198 return HMSetFileTime(arg1,
199 arg2,
200 arg3,
201 arg4);
202}
203//******************************************************************************
204//******************************************************************************
205INT WIN32API CompareFileTime( FILETIME * arg1, FILETIME * arg2)
206{
207 dprintf(("KERNEL32: CompareFileTime\n"));
208 return O32_CompareFileTime(arg1, arg2);
209}
210//******************************************************************************
211//******************************************************************************
212BOOL WIN32API CopyFileA(LPCSTR arg1, LPCSTR arg2, BOOL arg3)
213{
214 dprintf(("KERNEL32: CopyFile %s %s\n", arg1, arg2));
215 return O32_CopyFile(arg1, arg2, arg3);
216}
217//******************************************************************************
218//SvL: 24-6-'97 - Added
219//******************************************************************************
220BOOL WIN32API CopyFileW(LPCWSTR arg1, LPCWSTR arg2, BOOL arg3)
221{
222 BOOL rc;
223 char *astring1, *astring2;
224
225 astring1 = UnicodeToAsciiString((LPWSTR)arg1);
226 astring2 = UnicodeToAsciiString((LPWSTR)arg2);
227 dprintf(("KERNEL32: CopyFileW\n"));
228 rc = O32_CopyFile(astring1, astring2, arg3);
229 FreeAsciiString(astring2);
230 FreeAsciiString(astring1);
231 return(rc);
232}
233//******************************************************************************
234//******************************************************************************
235DWORD WIN32API GetFileSize( HANDLE arg1, PDWORD arg2)
236{
237 dprintf(("KERNEL32: GetFileSize (%08xh, %08xh)\n",
238 arg1,
239 arg2));
240
241 return HMGetFileSize(arg1,
242 arg2);
243}
244//******************************************************************************
245//******************************************************************************
246BOOL WIN32API DeleteFileA(LPCSTR arg1)
247{
248 dprintf(("KERNEL32: DeleteFile %s\n", arg1));
249 return O32_DeleteFile(arg1);
250}
251//******************************************************************************
252//******************************************************************************
253BOOL WIN32API DeleteFileW(LPCWSTR arg1)
254{
255 BOOL rc;
256 char *astring;
257
258 dprintf(("KERNEL32: DeleteFileW\n"));
259 astring = UnicodeToAsciiString((LPWSTR)arg1);
260 rc = O32_DeleteFile(astring);
261 FreeAsciiString(astring);
262 return(rc);
263}
264//******************************************************************************
265//******************************************************************************
266UINT WIN32API GetTempFileNameA(LPCSTR arg1, LPCSTR arg2, UINT arg3, LPSTR arg4)
267{
268 dprintf(("KERNEL32: GetTempFileName"));
269 return O32_GetTempFileName(arg1, arg2, arg3, arg4);
270}
271//******************************************************************************
272//******************************************************************************
273UINT WIN32API GetTempFileNameW(LPCWSTR lpPathName, LPCWSTR lpPrefixString,
274 UINT uUnique, LPWSTR lpTempFileName)
275{
276 char *asciipath, *asciiprefix;
277 char *asciitemp = (char *)malloc(MAX_PATH+1);
278 UINT rc;
279
280 dprintf(("KERNEL32: GetTempFileNameW"));
281 asciipath = UnicodeToAsciiString((LPWSTR)lpPathName);
282 asciiprefix = UnicodeToAsciiString((LPWSTR)lpPrefixString);
283 rc = O32_GetTempFileName(asciipath, asciiprefix, uUnique, asciitemp);
284 if(rc) AsciiToUnicode(asciitemp, lpTempFileName);
285 FreeAsciiString(asciiprefix);
286 FreeAsciiString(asciipath);
287 free(asciitemp);
288 return(rc);
289}
290//******************************************************************************
291//******************************************************************************
292UINT WIN32API GetTempPathA(UINT arg1, LPSTR arg2)
293{
294 dprintf(("KERNEL32: GetTempPath\n"));
295 return O32_GetTempPath(arg1, arg2);
296}
297//******************************************************************************
298//******************************************************************************
299UINT WIN32API GetTempPathW(UINT nBufferLength, LPWSTR lpBuffer)
300{
301 char *asciibuffer = (char *)malloc(nBufferLength+1);
302 DWORD rc;
303
304 dprintf(("KERNEL32: GetTempPathW\n"));
305 rc = O32_GetTempPath(nBufferLength, asciibuffer);
306 if(rc) AsciiToUnicode(asciibuffer, lpBuffer);
307 free(asciibuffer);
308 return(rc);
309}
310//******************************************************************************
311//******************************************************************************
312BOOL WIN32API ReadFile(HANDLE arg1,
313 PVOID arg2,
314 DWORD arg3,
315 PDWORD arg4,
316 LPOVERLAPPED arg5)
317{
318 BOOL rc;
319
320 rc = HMReadFile(arg1,
321 arg2,
322 arg3,
323 arg4,
324 arg5);
325
326 dprintf(("KERNEL32: ReadFile %X %d bytes returned %d\n",
327 arg1,
328 arg3,
329 rc));
330
331 return(rc);
332}
333//******************************************************************************
334//******************************************************************************
335DWORD WIN32API SetFilePointer(HANDLE hFile,
336 LONG lDistanceToMove,
337 PLONG lpDistanceToMoveHigh,
338 DWORD dwMoveMethod)
339{
340 dprintf(("KERNEL32: SetFilePointer(%08xh,%08xh,%08xh,%08xh)\n",
341 hFile,
342 lDistanceToMove,
343 lpDistanceToMoveHigh,
344 dwMoveMethod));
345
346 return(HMSetFilePointer(hFile,
347 lDistanceToMove,
348 lpDistanceToMoveHigh,
349 dwMoveMethod));
350}
351//******************************************************************************
352//******************************************************************************
353BOOL WIN32API WriteFile(HANDLE hFile,
354 LPCVOID buffer,
355 DWORD nrbytes,
356 LPDWORD nrbyteswritten,
357 LPOVERLAPPED lpOverlapped)
358{
359 dprintf(("KERNEL32: WriteFile(%08xh,%08xh,%08xh,%08xh,%08xh)\n",
360 hFile,
361 buffer,
362 nrbytes,
363 nrbyteswritten,
364 lpOverlapped));
365
366 return (HMWriteFile(hFile,
367 buffer,
368 nrbytes,
369 nrbyteswritten,
370 lpOverlapped));
371}
372//******************************************************************************
373//******************************************************************************
374DWORD WIN32API SearchPathA( LPCSTR arg1, LPCSTR arg2, LPCSTR arg3, DWORD arg4, LPSTR arg5, LPSTR * arg6)
375{
376 dprintf(("KERNEL32: SearchPathA\n"));
377 return O32_SearchPath(arg1, arg2, arg3, arg4, arg5, arg6);
378}
379//******************************************************************************
380//******************************************************************************
381DWORD WIN32API SearchPathW(LPCWSTR lpPath, LPCWSTR lpFileName, LPCWSTR lpExtension,
382 DWORD nBufferLength, LPWSTR lpBuffer, LPWSTR *lpFilePart)
383{
384 char *asciipath, *asciifile, *asciiext, *asciibuffer, *asciipart;
385 DWORD rc;
386
387 dprintf(("KERNEL32: SearchPathW"));
388 asciibuffer = (char *)malloc(nBufferLength+1);
389 asciipath = UnicodeToAsciiString((LPWSTR)lpPath);
390 asciifile = UnicodeToAsciiString((LPWSTR)lpFileName);
391 asciiext = UnicodeToAsciiString((LPWSTR)lpFileName);
392 rc = O32_SearchPath(asciipath, asciifile, asciiext, nBufferLength, asciibuffer, &asciipart);
393
394 if(rc) {
395 AsciiToUnicode(asciibuffer, lpBuffer);
396 *lpFilePart = lpBuffer + ((int)asciipart - (int)asciibuffer);
397 }
398 FreeAsciiString(asciiext);
399 FreeAsciiString(asciifile);
400 FreeAsciiString(asciipath);
401 free(asciibuffer);
402 return(rc);
403}
404//******************************************************************************
405//******************************************************************************
406DWORD WIN32API GetFileAttributesA(LPCSTR lpszFileName)
407{
408 DWORD rc, error;
409
410 rc = O32_GetFileAttributes((LPSTR)lpszFileName);
411#if 0 // need more tests, maybe there is also a better way to hide simulated b:
412 if(rc == -1 && lpszFileName != NULL && !strnicmp(lpszFileName, "B:", 2))
413 {
414 error = GetLastError();
415 if(error = ERROR_DISK_CHANGE)
416 SetLastError(ERROR_NOT_READY);
417 else
418 SetLastError(error);
419 }
420#endif
421 dprintf(("KERNEL32: GetFileAttributes of %s returned %d\n", lpszFileName, rc));
422 return(rc);
423}
424//******************************************************************************
425//******************************************************************************
426DWORD WIN32API GetFileAttributesW(LPCWSTR arg1)
427{
428 DWORD rc;
429 char *astring;
430
431 dprintf(("KERNEL32: GetFileAttributesW\n"));
432 astring = UnicodeToAsciiString((LPWSTR)arg1);
433 rc = O32_GetFileAttributes(astring);
434 FreeAsciiString(astring);
435 return(rc);
436}
437//******************************************************************************
438//******************************************************************************
439BOOL WIN32API SetFileAttributesA(LPCSTR arg1, DWORD arg2)
440{
441 dprintf(("KERNEL32: SetFileAttributes of %s\n", arg1));
442 return O32_SetFileAttributes(arg1, arg2);
443}
444//******************************************************************************
445//******************************************************************************
446BOOL WIN32API SetFileAttributesW(LPCWSTR lpFileName, DWORD dwFileAttributes)
447{
448 char *asciifile;
449 BOOL rc;
450
451 dprintf(("KERNEL32: SetFileAttributesW\n"));
452 asciifile = UnicodeToAsciiString((LPWSTR)lpFileName);
453 rc = O32_SetFileAttributes(asciifile, dwFileAttributes);
454 FreeAsciiString(asciifile);
455 return(rc);
456}
457//******************************************************************************
458//******************************************************************************
459DWORD WIN32API GetFullPathNameA(LPCSTR arg1, DWORD arg2, LPSTR arg3, LPSTR *arg4)
460{
461 dprintf(("KERNEL32: GetFullPathName %s\n", arg1));
462 return O32_GetFullPathName(arg1, arg2, arg3, arg4);
463}
464//******************************************************************************
465//******************************************************************************
466DWORD WIN32API GetFullPathNameW(LPCWSTR lpFileName, DWORD nBufferLength,
467 LPWSTR lpBuffer, LPWSTR *lpFilePart)
468{
469 char *astring, *asciibuffer, *asciipart;
470 DWORD rc;
471
472 dprintf(("KERNEL32: GetFullPathNameW\n"));
473 asciibuffer = (char *)malloc(nBufferLength+1);
474 astring = UnicodeToAsciiString((LPWSTR)lpFileName);
475
476 rc = O32_GetFullPathName(astring,
477 nBufferLength,
478 asciibuffer,
479 &asciipart);
480
481 dprintf(("KERNEL32: GetFullPathNameW %s returns %s\n",
482 astring,
483 asciibuffer));
484
485 if(rc)
486 AsciiToUnicode(asciibuffer,
487 lpBuffer);
488
489 if(lpFilePart)
490 *lpFilePart = lpBuffer + ((int)asciipart - (int)asciibuffer);
491
492 FreeAsciiString(astring);
493 free(asciibuffer);
494 return(rc);
495}
496//******************************************************************************
497//******************************************************************************
498BOOL WIN32API LockFile(HANDLE arg1,
499 DWORD arg2,
500 DWORD arg3,
501 DWORD arg4,
502 DWORD arg5)
503{
504 dprintf(("KERNEL32: LockFile (%08xh,%08xh,%08xh,%08xh,%08xh)\n",
505 arg1,
506 arg2,
507 arg3,
508 arg4,
509 arg5));
510
511 return HMLockFile(arg1,
512 arg2,
513 arg3,
514 arg4,
515 arg5);
516}
517
518
519/*****************************************************************************
520 * Name : BOOL LockFileEx
521 * Purpose : The LockFileEx function locks a byte range within an open file for shared or exclusive access.
522 * Parameters: HANDLE hFile handle of file to lock
523 * DWORD dwFlags functional behavior modification flags
524 * DWORD dwReserved reserved, must be set to zero
525 * DWORD nNumberOfBytesToLockLow low-order 32 bits of length to lock
526 * DWORD nNumberOfBytesToLockHigh high-order 32 bits of length to lock
527 * LPOVERLAPPED LPOVERLAPPED addr. of structure with lock region start offset
528 * Variables :
529 * Result : TRUE / FALSE
530 * Remark :
531 * Status : UNTESTED STUB
532 *
533 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
534 *****************************************************************************/
535
536BOOL WIN32API LockFileEx(HANDLE hFile,
537 DWORD dwFlags,
538 DWORD dwReserved,
539 DWORD nNumberOfBytesToLockLow,
540 DWORD nNumberOfBytesToLockHigh,
541 LPOVERLAPPED lpOverlapped)
542{
543 dprintf(("Kernel32: LockFileEx(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh)\n",
544 hFile,
545 dwFlags,
546 dwReserved,
547 nNumberOfBytesToLockLow,
548 nNumberOfBytesToLockHigh,
549 lpOverlapped));
550
551 return(HMLockFile(hFile,
552 lpOverlapped->Offset,
553 lpOverlapped->OffsetHigh,
554 nNumberOfBytesToLockLow,
555 nNumberOfBytesToLockHigh));
556}
557
558
559
560
561//******************************************************************************
562//******************************************************************************
563BOOL WIN32API MoveFileA( LPCSTR arg1, LPCSTR arg2)
564{
565 dprintf(("KERNEL32: MoveFileA\n"));
566 return O32_MoveFile(arg1, arg2);
567}
568//******************************************************************************
569//******************************************************************************
570BOOL WIN32API MoveFileExA(LPCSTR arg1,
571 LPCSTR arg2,
572 DWORD fdwFlags)
573{
574 dprintf(("KERNEL32: MoveFileExA %s to %s, not complete!\n", arg1, arg2));
575 return O32_MoveFile(arg1, arg2);
576}
577//******************************************************************************
578//******************************************************************************
579BOOL WIN32API MoveFileW(LPCWSTR lpSrc, LPCWSTR lpDest)
580{
581 char *asciisrc, *asciidest;
582 BOOL rc;
583
584 dprintf(("KERNEL32: MoveFileW\n"));
585 asciisrc = UnicodeToAsciiString((LPWSTR)lpSrc);
586 asciidest = UnicodeToAsciiString((LPWSTR)lpDest);
587 rc = O32_MoveFile(asciisrc, asciidest);
588 FreeAsciiString(asciisrc);
589 FreeAsciiString(asciidest);
590 return(rc);
591}
592//******************************************************************************
593//******************************************************************************
594BOOL WIN32API MoveFileExW(LPCWSTR arg1,
595 LPCWSTR arg2,
596 DWORD fdwFlags)
597{
598 dprintf(("KERNEL32: MoveFileExW %s to %s, not complete!\n", arg1, arg2));
599 return MoveFileW(arg1, arg2);
600}
601//******************************************************************************
602/*****************************************************************************
603 * Name : HFILE WIN32API OpenFile
604 * Purpose : forward OpenFile to Open32
605 * Parameters:
606 * Variables :
607 * Result : API returncode
608 * Remark : modified for handle translation support
609 * Status : @@@PH verify if 0 is a valid "invalid handle" :)
610 *
611 * Author : Patrick Haller [Fri, 1998/06/12 02:53]
612 *****************************************************************************/
613
614HFILE WIN32API OpenFile(LPCSTR arg1,
615 OFSTRUCT *arg2,
616 UINT arg3)
617{
618 HFILE hFile;
619
620 dprintf(("KERNEL32: OpenFile(%s, %08xh, %08xh)\n",
621 arg1,
622 arg2,
623 arg3));
624
625 hFile = HMOpenFile(arg1, /* call open32 */
626 arg2,
627 arg3);
628
629 return (hFile);
630}
631//******************************************************************************
632//******************************************************************************
633BOOL WIN32API UnlockFile(HANDLE arg1,
634 DWORD arg2,
635 DWORD arg3,
636 DWORD arg4,
637 DWORD arg5)
638{
639 dprintf(("KERNEL32: UnlockFile(%08xh,%08xh,%08xh,%08xh,%08xh)\n",
640 arg1,
641 arg2,
642 arg3,
643 arg4,
644 arg5));
645
646 return HMUnlockFile(arg1,
647 arg2,
648 arg3,
649 arg4,
650 arg5);
651}
652
653
654/*****************************************************************************
655 * Name : BOOL UnlockFileEx
656 * Purpose : The UnlockFileEx function unlocks a previously locked byte range in an open file.
657 * Parameters: HANDLE hFile handle of file to lock
658 * DWORD dwReserved reserved, must be set to zero
659 * DWORD nNumberOfBytesToLockLow low-order 32 bits of length to lock
660 * DWORD nNumberOfBytesToLockHigh high-order 32 bits of length to lock
661 * LPOVERLAPPED LPOVERLAPPED addr. of structure with lock region start offset
662 * Variables :
663 * Result : TRUE / FALSE
664 * Remark :
665 * Status : UNTESTED STUB
666 *
667 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
668 *****************************************************************************/
669
670BOOL WIN32API UnlockFileEx(HANDLE hFile,
671 DWORD dwReserved,
672 DWORD nNumberOfBytesToLockLow,
673 DWORD nNumberOfBytesToLockHigh,
674 LPOVERLAPPED lpOverlapped)
675{
676 dprintf(("Kernel32: UnlockFileEx(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh)\n",
677 hFile,
678 dwReserved,
679 nNumberOfBytesToLockLow,
680 nNumberOfBytesToLockHigh,
681 lpOverlapped));
682
683 return(HMUnlockFile(hFile,
684 lpOverlapped->Offset,
685 lpOverlapped->OffsetHigh,
686 nNumberOfBytesToLockLow,
687 nNumberOfBytesToLockHigh));
688}
689//******************************************************************************
690//******************************************************************************
691DWORD WIN32API GetShortPathNameA(LPCTSTR lpszLongPath, LPTSTR lpszShortPath,
692 DWORD cchBuffer)
693{
694 int length;
695
696 dprintf(("KERNEL32: GetShortPathNameA of %s, just copying it\n", lpszLongPath));
697 length = strlen(lpszLongPath) + 1;
698 if(length > cchBuffer) {
699 *lpszShortPath = 0;
700 return(length);
701 }
702 memcpy(lpszShortPath, lpszLongPath, length);
703 return(length-1);
704}
705//******************************************************************************
706//******************************************************************************
707DWORD WIN32API GetShortPathNameW(LPCWSTR lpszLongPath, LPWSTR lpszShortPath,
708 DWORD cchBuffer)
709{
710 int length;
711
712 dprintf(("KERNEL32: GetShortPathNameW; just copying it\n"));
713 length = UniStrlen((UniChar*)lpszLongPath) + 1;
714 if(length > cchBuffer) {
715 *lpszShortPath = 0;
716 return(length);
717 }
718 memcpy(lpszShortPath, lpszLongPath, length*sizeof(USHORT));
719 return(length-1);
720}
721//******************************************************************************
722//******************************************************************************
723HANDLE WIN32API FindFirstChangeNotificationA(LPCSTR lpPathName, BOOL bWatchSubtree,
724 DWORD dwNotifyFilter)
725{
726 dprintf(("KERNEL32: FindFirstChangeNotificationA, Not implemented\n"));
727 return(0);
728}
729//******************************************************************************
730//******************************************************************************
731BOOL WIN32API FindNextChangeNotification(HANDLE hChange)
732{
733 dprintf(("KERNEL32: FindNextChangeNotification (%08xh), Not implemented\n",
734 hChange));
735
736 return(0);
737}
738//******************************************************************************
739//******************************************************************************
740VOID WIN32API SetFileApisToANSI( VOID ) /*PLF Tue 98-02-10 00:52:22*/
741{
742 dprintf(("SetFileApisToANSI() stub\n"));
743}
744
745/*****************************************************************************
746 * Name : DWORD GetCompressedFileSizeA
747 * Purpose : The GetCompressedFileSizeA function obtains the compressed
748 * size, in bytes, of a specified file.
749 * Parameters: LPCTSTR lpFileName, // pointer to name of file
750 * LPDWORD lpFileSizeHigh // pointer to DWORD to receive
751 * high-order doubleword of file size
752 * Variables :
753 * Result : size of compressed file
754 * Remark :
755 * Status : UNTESTED
756 *
757 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
758 *****************************************************************************/
759
760DWORD WIN32API GetCompressedFileSizeA(LPCTSTR lpFileName,
761 LPDWORD lpFileSizeHigh)
762{
763 dprintf(("KERNEL32: GetCompressedFileSizeA (%s, %08xh) not implemented.\n",
764 lpFileName,
765 lpFileSizeHigh));
766
767 /* PH: simply return the standard filesize */
768 return 0;
769}
770
771
772/*****************************************************************************
773 * Name : DWORD GetCompressedFileSizeW
774 * Purpose : The GetCompressedFileSizeE function obtains the compressed
775 * size, in bytes, of a specified file.
776 * Parameters: LPCWSTR lpFileName, // pointer to name of file
777 * LPDWORD lpFileSizeHigh // pointer to DWORD to receive
778 * high-order doubleword of file size
779 * Variables :
780 * Result : size of compressed file
781 * Remark :
782 * Status : UNTESTED
783 *
784 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
785 *****************************************************************************/
786
787DWORD WIN32API GetCompressedFileSizeW(LPCWSTR lpFileName,
788 LPDWORD lpFileSizeHigh)
789{
790 LPCTSTR lpAsciiFileName; /* converted filename */
791 DWORD rc; /* function result */
792
793 dprintf(("KERNEL32: GetCompressedFileSizeW (%s, %08xh)\n",
794 lpFileName,
795 lpFileSizeHigh));
796
797 lpAsciiFileName = UnicodeToAsciiString( (LPWSTR) lpFileName);
798
799 rc = GetCompressedFileSizeA(lpAsciiFileName,
800 lpFileSizeHigh);
801
802 FreeAsciiString( (char *) lpAsciiFileName);
803
804 return (rc); /* return result */
805}
806
807
808/*****************************************************************************
809 * Name : BOOL GetFileAttributesExA
810 * Purpose :
811 * Parameters:
812 * Variables :
813 * Result :
814 * Remark : KERNEL32.874
815 * Status : UNTESTED
816 *
817 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
818 *****************************************************************************/
819
820BOOL WIN32API GetFileAttributesExA(LPCSTR lpFileName,
821 GET_FILEEX_INFO_LEVELS fInfoLevelId,
822 LPVOID lpFileInformation)
823{
824 BOOL rc;
825
826 dprintf(("KERNEL32: GetFileAttributesExA(%s,%08xh,%08xh) mostly implemented.\n",
827 lpFileName,
828 fInfoLevelId,
829 lpFileInformation));
830
831 if (lpFileName == NULL) return FALSE;
832 if (lpFileInformation == NULL) return FALSE;
833
834 if (fInfoLevelId == GetFileExInfoStandard)
835 {
836 LPWIN32_FILE_ATTRIBUTE_DATA lpFad = (LPWIN32_FILE_ATTRIBUTE_DATA) lpFileInformation;
837
838 rc = OSLibDosGetFileAttributesEx((LPSTR)lpFileName,
839 fInfoLevelId,
840 lpFileInformation);
841 return (rc);
842 }
843 else
844 {
845 dprintf(("KERNEL32: GetFileAttributesExA - invalid info level %d!\n",
846 fInfoLevelId));
847 return FALSE;
848 }
849}
850
851
852/*****************************************************************************
853 * Name : BOOL GetFileAttributesExW
854 * Purpose :
855 * Parameters:
856 * Variables :
857 * Result :
858 * Remark : KERNEL32.875
859 * Status : UNTESTED
860 *
861 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
862 *****************************************************************************/
863
864BOOL WINAPI GetFileAttributesExW(LPCWSTR lpFileName,
865 GET_FILEEX_INFO_LEVELS fInfoLevelId,
866 LPVOID lpFileInformation)
867{
868 LPSTR nameA = HEAP_strdupWtoA( GetProcessHeap(), 0, lpFileName );
869 BOOL res = GetFileAttributesExA( nameA, fInfoLevelId, lpFileInformation);
870 HeapFree( GetProcessHeap(), 0, nameA );
871 return res;
872}
873
Note: See TracBrowser for help on using the repository browser.