2 * Win32 kernel functions
4 * Copyright 1995 Martin von Loewis, Sven Verdoolaege, and Cameron Heide
11 #include <sys/types.h>
26 DWORD ErrnoToLastError(int errno_num);
28 /***********************************************************************
29 * ReadFileEx (KERNEL32.)
33 (CALLBACK *LPOVERLAPPED_COMPLETION_ROUTINE)(
35 DWORD dwNumberOfBytesTransfered,
36 LPOVERLAPPED lpOverlapped
39 BOOL32 WINAPI ReadFileEx(HFILE32 hFile, LPVOID lpBuffer, DWORD numtoread,
40 LPOVERLAPPED lpOverlapped,
41 LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine)
44 FIXME(file, "file %d to buf %p num %ld %p func %p stub\n",
45 hFile, lpBuffer, numtoread, lpOverlapped, lpCompletionRoutine);
46 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
50 /**************************************************************************
51 * SetFileAttributes16 (KERNEL.421)
53 BOOL16 WINAPI SetFileAttributes16( LPCSTR lpFileName, DWORD attributes )
55 return SetFileAttributes32A( lpFileName, attributes );
59 /**************************************************************************
60 * SetFileAttributes32A (KERNEL32.490)
62 BOOL32 WINAPI SetFileAttributes32A(LPCSTR lpFileName, DWORD attributes)
65 DOS_FULL_NAME full_name;
67 if (!DOSFS_GetFullName( lpFileName, TRUE, &full_name ))
70 TRACE(file,"(%s,%lx)\n",lpFileName,attributes);
71 if (attributes & FILE_ATTRIBUTE_NORMAL) {
72 attributes &= ~FILE_ATTRIBUTE_NORMAL;
74 FIXME(file,"(%s):%lx illegal combination with FILE_ATTRIBUTE_NORMAL.\n",
75 lpFileName,attributes);
77 if(stat(full_name.long_name,&buf)==-1)
79 SetLastError(ErrnoToLastError(errno));
82 if (attributes & FILE_ATTRIBUTE_READONLY)
84 buf.st_mode &= ~0222; /* octal!, clear write permission bits */
85 attributes &= ~FILE_ATTRIBUTE_READONLY;
89 /* add write permission */
90 buf.st_mode |= 0600 | ((buf.st_mode & 044) >> 1);
92 attributes &= ~(FILE_ATTRIBUTE_ARCHIVE|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_SYSTEM);
94 FIXME(file,"(%s):%lx attribute(s) not implemented.\n",
95 lpFileName,attributes);
96 if (-1==chmod(full_name.long_name,buf.st_mode))
98 MSG("Wine ERROR: Couldn't set file attributes for existing file \"%s\". Check permissions !\n", full_name.long_name);
99 SetLastError(ErrnoToLastError(errno));
106 /**************************************************************************
107 * SetFileAttributes32W (KERNEL32.491)
109 BOOL32 WINAPI SetFileAttributes32W(LPCWSTR lpFileName, DWORD attributes)
111 LPSTR afn = HEAP_strdupWtoA( GetProcessHeap(), 0, lpFileName );
112 BOOL32 res = SetFileAttributes32A( afn, attributes );
113 HeapFree( GetProcessHeap(), 0, afn );
118 /**************************************************************************
119 * SetFileApisToOEM (KERNEL32.645)
121 VOID WINAPI SetFileApisToOEM(void)
123 /*FIXME(file,"(): stub!\n");*/
127 /**************************************************************************
128 * SetFileApisToANSI (KERNEL32.644)
130 VOID WINAPI SetFileApisToANSI(void)
132 /*FIXME(file,"(): stub\n");*/
136 /******************************************************************************
137 * AreFileApisANSI [KERNEL32.105] Determines if file functions are using ANSI
140 * TRUE: Set of file functions is using ANSI code page
141 * FALSE: Set of file functions is using OEM code page
143 BOOL32 WINAPI AreFileApisANSI(void)
145 FIXME(file,"(void): stub\n");