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

Last change on this file since 17 was 17, checked in by phaller, 26 years ago

Code cleanup #1 for build, mainly addresses linkage problems

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