Commit 62b6bef3 authored by Alexandre Julliard's avatar Alexandre Julliard

Moved a number of 16-bit functions to file16.c.

parent c2fbb406
......@@ -45,23 +45,37 @@
WINE_DEFAULT_DEBUG_CHANNEL(file);
/***********************************************************************
* _hread16 (KERNEL.349)
* GetProfileInt (KERNEL.57)
*/
LONG WINAPI _hread16( HFILE16 hFile, LPVOID buffer, LONG count)
UINT16 WINAPI GetProfileInt16( LPCSTR section, LPCSTR entry, INT16 def_val )
{
return _lread( (HFILE)DosFileHandleToWin32Handle(hFile), buffer, count );
return GetPrivateProfileInt16( section, entry, def_val, "win.ini" );
}
/***********************************************************************
* _hwrite (KERNEL.350)
* GetProfileString (KERNEL.58)
*/
LONG WINAPI _hwrite16( HFILE16 hFile, LPCSTR buffer, LONG count )
INT16 WINAPI GetProfileString16( LPCSTR section, LPCSTR entry, LPCSTR def_val,
LPSTR buffer, UINT16 len )
{
return _hwrite( (HFILE)DosFileHandleToWin32Handle(hFile), buffer, count );
return GetPrivateProfileString16( section, entry, def_val,
buffer, len, "win.ini" );
}
/***********************************************************************
* WriteProfileString (KERNEL.59)
*/
BOOL16 WINAPI WriteProfileString16( LPCSTR section, LPCSTR entry,
LPCSTR string )
{
return WritePrivateProfileString16( section, entry, string, "win.ini" );
}
/***********************************************************************
* _lclose (KERNEL.81)
*/
......@@ -152,23 +166,6 @@ UINT16 WINAPI WIN16_lread( HFILE16 hFile, SEGPTR buffer, UINT16 count )
/***********************************************************************
* DeleteFile (KERNEL.146)
*/
BOOL16 WINAPI DeleteFile16( LPCSTR path )
{
return DeleteFileA( path );
}
/**************************************************************************
* GetFileAttributes (KERNEL.420)
*/
DWORD WINAPI GetFileAttributes16( LPCSTR name )
{
return GetFileAttributesA( name );
}
/***********************************************************************
* GetTempFileName (KERNEL.97)
*/
UINT16 WINAPI GetTempFileName16( BYTE drive, LPCSTR prefix, UINT16 unique,
......@@ -216,12 +213,114 @@ UINT16 WINAPI GetTempFileName16( BYTE drive, LPCSTR prefix, UINT16 unique,
return ret;
}
/**************************************************************************
* SetFileAttributes (KERNEL.421)
/***********************************************************************
* GetPrivateProfileInt (KERNEL.127)
*/
BOOL16 WINAPI SetFileAttributes16( LPCSTR lpFileName, DWORD attributes )
UINT16 WINAPI GetPrivateProfileInt16( LPCSTR section, LPCSTR entry,
INT16 def_val, LPCSTR filename )
{
return SetFileAttributesA( lpFileName, attributes );
/* we used to have some elaborate return value limitation (<= -32768 etc.)
* here, but Win98SE doesn't care about this at all, so I deleted it.
* AFAIR versions prior to Win9x had these limits, though. */
return (INT16)GetPrivateProfileIntA(section,entry,def_val,filename);
}
/***********************************************************************
* WritePrivateProfileString (KERNEL.129)
*/
BOOL16 WINAPI WritePrivateProfileString16( LPCSTR section, LPCSTR entry,
LPCSTR string, LPCSTR filename )
{
return WritePrivateProfileStringA(section,entry,string,filename);
}
/***********************************************************************
* GetWindowsDirectory (KERNEL.134)
*/
UINT16 WINAPI GetWindowsDirectory16( LPSTR path, UINT16 count )
{
return GetWindowsDirectoryA( path, count );
}
/***********************************************************************
* GetSystemDirectory (KERNEL.135)
*/
UINT16 WINAPI GetSystemDirectory16( LPSTR path, UINT16 count )
{
return GetSystemDirectoryA( path, count );
}
/***********************************************************************
* GetDriveType (KERNEL.136)
* This function returns the type of a drive in Win16.
* Note that it returns DRIVE_REMOTE for CD-ROMs, since MSCDEX uses the
* remote drive API. The return value DRIVE_REMOTE for CD-ROMs has been
* verified on Win 3.11 and Windows 95. Some programs rely on it, so don't
* do any pseudo-clever changes.
*/
UINT16 WINAPI GetDriveType16( UINT16 drive ) /* [in] number (NOT letter) of drive */
{
UINT type;
WCHAR root[3];
root[0] = 'A' + drive;
root[1] = ':';
root[2] = 0;
type = GetDriveTypeW( root );
if (type == DRIVE_CDROM) type = DRIVE_REMOTE;
return type;
}
/***********************************************************************
* GetProfileSectionNames (KERNEL.142)
*/
WORD WINAPI GetProfileSectionNames16(LPSTR buffer, WORD size)
{
return GetPrivateProfileSectionNamesA(buffer,size,"win.ini");
}
/***********************************************************************
* GetPrivateProfileSectionNames (KERNEL.143)
*/
WORD WINAPI GetPrivateProfileSectionNames16( LPSTR buffer, WORD size,
LPCSTR filename )
{
return GetPrivateProfileSectionNamesA(buffer,size,filename);
}
/***********************************************************************
* CreateDirectory (KERNEL.144)
*/
BOOL16 WINAPI CreateDirectory16( LPCSTR path, LPVOID dummy )
{
return CreateDirectoryA( path, NULL );
}
/***********************************************************************
* RemoveDirectory (KERNEL.145)
*/
BOOL16 WINAPI RemoveDirectory16( LPCSTR path )
{
return RemoveDirectoryA( path );
}
/***********************************************************************
* DeleteFile (KERNEL.146)
*/
BOOL16 WINAPI DeleteFile16( LPCSTR path )
{
return DeleteFileA( path );
}
......@@ -234,6 +333,53 @@ UINT16 WINAPI SetHandleCount16( UINT16 count )
}
/***********************************************************************
* _hread16 (KERNEL.349)
*/
LONG WINAPI _hread16( HFILE16 hFile, LPVOID buffer, LONG count)
{
return _lread( (HFILE)DosFileHandleToWin32Handle(hFile), buffer, count );
}
/***********************************************************************
* _hwrite (KERNEL.350)
*/
LONG WINAPI _hwrite16( HFILE16 hFile, LPCSTR buffer, LONG count )
{
return _hwrite( (HFILE)DosFileHandleToWin32Handle(hFile), buffer, count );
}
/***********************************************************************
* WritePrivateProfileStruct (KERNEL.406)
*/
BOOL16 WINAPI WritePrivateProfileStruct16 (LPCSTR section, LPCSTR key,
LPVOID buf, UINT16 bufsize, LPCSTR filename)
{
return WritePrivateProfileStructA( section, key, buf, bufsize, filename );
}
/***********************************************************************
* GetPrivateProfileStruct (KERNEL.407)
*/
BOOL16 WINAPI GetPrivateProfileStruct16(LPCSTR section, LPCSTR key,
LPVOID buf, UINT16 len, LPCSTR filename)
{
return GetPrivateProfileStructA( section, key, buf, len, filename );
}
/***********************************************************************
* SetCurrentDirectory (KERNEL.412)
*/
BOOL16 WINAPI SetCurrentDirectory16( LPCSTR dir )
{
return SetCurrentDirectoryA( dir );
}
/*************************************************************************
* FindFirstFile (KERNEL.413)
*/
......@@ -292,3 +438,71 @@ BOOL16 WINAPI FindClose16( HANDLE16 handle )
GlobalFree16( handle );
return TRUE;
}
/***********************************************************************
* WritePrivateProfileSection (KERNEL.416)
*/
BOOL16 WINAPI WritePrivateProfileSection16( LPCSTR section,
LPCSTR string, LPCSTR filename )
{
return WritePrivateProfileSectionA( section, string, filename );
}
/***********************************************************************
* WriteProfileSection (KERNEL.417)
*/
BOOL16 WINAPI WriteProfileSection16( LPCSTR section, LPCSTR keys_n_values)
{
return WritePrivateProfileSection16( section, keys_n_values, "win.ini");
}
/***********************************************************************
* GetPrivateProfileSection (KERNEL.418)
*/
INT16 WINAPI GetPrivateProfileSection16( LPCSTR section, LPSTR buffer,
UINT16 len, LPCSTR filename )
{
return GetPrivateProfileSectionA( section, buffer, len, filename );
}
/***********************************************************************
* GetProfileSection (KERNEL.419)
*/
INT16 WINAPI GetProfileSection16( LPCSTR section, LPSTR buffer, UINT16 len )
{
return GetPrivateProfileSection16( section, buffer, len, "win.ini" );
}
/**************************************************************************
* GetFileAttributes (KERNEL.420)
*/
DWORD WINAPI GetFileAttributes16( LPCSTR name )
{
return GetFileAttributesA( name );
}
/**************************************************************************
* SetFileAttributes (KERNEL.421)
*/
BOOL16 WINAPI SetFileAttributes16( LPCSTR lpFileName, DWORD attributes )
{
return SetFileAttributesA( lpFileName, attributes );
}
/***********************************************************************
* GetDiskFreeSpace (KERNEL.422)
*/
BOOL16 WINAPI GetDiskFreeSpace16( LPCSTR root, LPDWORD cluster_sectors,
LPDWORD sector_bytes, LPDWORD free_clusters,
LPDWORD total_clusters )
{
return GetDiskFreeSpaceA( root, cluster_sectors, sector_bytes,
free_clusters, total_clusters );
}
......@@ -1020,14 +1020,6 @@ static BOOL PROFILE_SetString( LPCWSTR section_name, LPCWSTR key_name,
/********************* API functions **********************************/
/***********************************************************************
* GetProfileInt (KERNEL.57)
*/
UINT16 WINAPI GetProfileInt16( LPCSTR section, LPCSTR entry, INT16 def_val )
{
return GetPrivateProfileInt16( section, entry, def_val, "win.ini" );
}
/***********************************************************************
* GetProfileIntA (KERNEL32.@)
......@@ -1212,16 +1204,6 @@ INT WINAPI GetPrivateProfileStringW( LPCWSTR section, LPCWSTR entry,
}
/***********************************************************************
* GetProfileString (KERNEL.58)
*/
INT16 WINAPI GetProfileString16( LPCSTR section, LPCSTR entry, LPCSTR def_val,
LPSTR buffer, UINT16 len )
{
return GetPrivateProfileString16( section, entry, def_val,
buffer, len, "win.ini" );
}
/***********************************************************************
* GetProfileStringA (KERNEL32.@)
*/
INT WINAPI GetProfileStringA( LPCSTR section, LPCSTR entry, LPCSTR def_val,
......@@ -1242,15 +1224,6 @@ INT WINAPI GetProfileStringW( LPCWSTR section, LPCWSTR entry,
}
/***********************************************************************
* WriteProfileString (KERNEL.59)
*/
BOOL16 WINAPI WriteProfileString16( LPCSTR section, LPCSTR entry,
LPCSTR string )
{
return WritePrivateProfileString16( section, entry, string, "win.ini" );
}
/***********************************************************************
* WriteProfileStringA (KERNEL32.@)
*/
BOOL WINAPI WriteProfileStringA( LPCSTR section, LPCSTR entry,
......@@ -1270,18 +1243,6 @@ BOOL WINAPI WriteProfileStringW( LPCWSTR section, LPCWSTR entry,
/***********************************************************************
* GetPrivateProfileInt (KERNEL.127)
*/
UINT16 WINAPI GetPrivateProfileInt16( LPCSTR section, LPCSTR entry,
INT16 def_val, LPCSTR filename )
{
/* we used to have some elaborate return value limitation (<= -32768 etc.)
* here, but Win98SE doesn't care about this at all, so I deleted it.
* AFAIR versions prior to Win9x had these limits, though. */
return (INT16)GetPrivateProfileIntA(section,entry,def_val,filename);
}
/***********************************************************************
* GetPrivateProfileIntW (KERNEL32.@)
*/
UINT WINAPI GetPrivateProfileIntW( LPCWSTR section, LPCWSTR entry,
......@@ -1336,15 +1297,6 @@ UINT WINAPI GetPrivateProfileIntA( LPCSTR section, LPCSTR entry,
}
/***********************************************************************
* GetPrivateProfileSection (KERNEL.418)
*/
INT16 WINAPI GetPrivateProfileSection16( LPCSTR section, LPSTR buffer,
UINT16 len, LPCSTR filename )
{
return GetPrivateProfileSectionA( section, buffer, len, filename );
}
/***********************************************************************
* GetPrivateProfileSectionW (KERNEL32.@)
*/
INT WINAPI GetPrivateProfileSectionW( LPCWSTR section, LPWSTR buffer,
......@@ -1406,14 +1358,6 @@ INT WINAPI GetPrivateProfileSectionA( LPCSTR section, LPSTR buffer,
}
/***********************************************************************
* GetProfileSection (KERNEL.419)
*/
INT16 WINAPI GetProfileSection16( LPCSTR section, LPSTR buffer, UINT16 len )
{
return GetPrivateProfileSection16( section, buffer, len, "win.ini" );
}
/***********************************************************************
* GetProfileSectionA (KERNEL32.@)
*/
INT WINAPI GetProfileSectionA( LPCSTR section, LPSTR buffer, DWORD len )
......@@ -1431,15 +1375,6 @@ INT WINAPI GetProfileSectionW( LPCWSTR section, LPWSTR buffer, DWORD len )
/***********************************************************************
* WritePrivateProfileString (KERNEL.129)
*/
BOOL16 WINAPI WritePrivateProfileString16( LPCSTR section, LPCSTR entry,
LPCSTR string, LPCSTR filename )
{
return WritePrivateProfileStringA(section,entry,string,filename);
}
/***********************************************************************
* WritePrivateProfileStringW (KERNEL32.@)
*/
BOOL WINAPI WritePrivateProfileStringW( LPCWSTR section, LPCWSTR entry,
......@@ -1499,15 +1434,6 @@ BOOL WINAPI WritePrivateProfileStringA( LPCSTR section, LPCSTR entry,
}
/***********************************************************************
* WritePrivateProfileSection (KERNEL.416)
*/
BOOL16 WINAPI WritePrivateProfileSection16( LPCSTR section,
LPCSTR string, LPCSTR filename )
{
return WritePrivateProfileSectionA( section, string, filename );
}
/***********************************************************************
* WritePrivateProfileSectionW (KERNEL32.@)
*/
BOOL WINAPI WritePrivateProfileSectionW( LPCWSTR section,
......@@ -1582,14 +1508,6 @@ BOOL WINAPI WritePrivateProfileSectionA( LPCSTR section,
}
/***********************************************************************
* WriteProfileSection (KERNEL.417)
*/
BOOL16 WINAPI WriteProfileSection16( LPCSTR section, LPCSTR keys_n_values)
{
return WritePrivateProfileSection16( section, keys_n_values, "win.ini");
}
/***********************************************************************
* WriteProfileSectionA (KERNEL32.@)
*/
BOOL WINAPI WriteProfileSectionA( LPCSTR section, LPCSTR keys_n_values)
......@@ -1606,25 +1524,6 @@ BOOL WINAPI WriteProfileSectionW( LPCWSTR section, LPCWSTR keys_n_values)
return WritePrivateProfileSectionW(section, keys_n_values, wininiW);
}
/***********************************************************************
* GetPrivateProfileSectionNames (KERNEL.143)
*/
WORD WINAPI GetPrivateProfileSectionNames16( LPSTR buffer, WORD size,
LPCSTR filename )
{
return GetPrivateProfileSectionNamesA(buffer,size,filename);
}
/***********************************************************************
* GetProfileSectionNames (KERNEL.142)
*/
WORD WINAPI GetProfileSectionNames16(LPSTR buffer, WORD size)
{
return GetPrivateProfileSectionNamesA(buffer,size,"win.ini");
}
/***********************************************************************
* GetPrivateProfileSectionNamesW (KERNEL32.@)
......@@ -1710,15 +1609,6 @@ DWORD WINAPI GetPrivateProfileSectionNamesA( LPSTR buffer, DWORD size,
}
/***********************************************************************
* GetPrivateProfileStruct (KERNEL.407)
*/
BOOL16 WINAPI GetPrivateProfileStruct16(LPCSTR section, LPCSTR key,
LPVOID buf, UINT16 len, LPCSTR filename)
{
return GetPrivateProfileStructA( section, key, buf, len, filename );
}
/***********************************************************************
* GetPrivateProfileStructW (KERNEL32.@)
*
* Should match Win95's behaviour pretty much
......@@ -1822,15 +1712,6 @@ BOOL WINAPI GetPrivateProfileStructA (LPCSTR section, LPCSTR key,
/***********************************************************************
* WritePrivateProfileStruct (KERNEL.406)
*/
BOOL16 WINAPI WritePrivateProfileStruct16 (LPCSTR section, LPCSTR key,
LPVOID buf, UINT16 bufsize, LPCSTR filename)
{
return WritePrivateProfileStructA( section, key, buf, bufsize, filename );
}
/***********************************************************************
* WritePrivateProfileStructW (KERNEL32.@)
*/
BOOL WINAPI WritePrivateProfileStructW (LPCWSTR section, LPCWSTR key,
......
......@@ -370,15 +370,6 @@ UINT WINAPI GetTempDrive( BYTE ignored )
/***********************************************************************
* GetWindowsDirectory (KERNEL.134)
*/
UINT16 WINAPI GetWindowsDirectory16( LPSTR path, UINT16 count )
{
return (UINT16)GetWindowsDirectoryA( path, count );
}
/***********************************************************************
* GetWindowsDirectoryW (KERNEL32.@)
*
* See comment for GetWindowsDirectoryA.
......@@ -435,15 +426,6 @@ UINT WINAPI GetSystemWindowsDirectoryW( LPWSTR path, UINT count )
/***********************************************************************
* GetSystemDirectory (KERNEL.135)
*/
UINT16 WINAPI GetSystemDirectory16( LPSTR path, UINT16 count )
{
return (UINT16)GetSystemDirectoryA( path, count );
}
/***********************************************************************
* GetSystemDirectoryW (KERNEL32.@)
*
* See comment for GetWindowsDirectoryA.
......@@ -478,16 +460,6 @@ UINT WINAPI GetSystemDirectoryA( LPSTR path, UINT count )
/***********************************************************************
* CreateDirectory (KERNEL.144)
*/
BOOL16 WINAPI CreateDirectory16( LPCSTR path, LPVOID dummy )
{
TRACE_(file)("(%s,%p)\n", path, dummy );
return (BOOL16)CreateDirectoryA( path, NULL );
}
/***********************************************************************
* CreateDirectoryW (KERNEL32.@)
* RETURNS:
* TRUE : success
......@@ -586,15 +558,6 @@ BOOL WINAPI CreateDirectoryExW( LPCWSTR template, LPCWSTR path,
/***********************************************************************
* RemoveDirectory (KERNEL.145)
*/
BOOL16 WINAPI RemoveDirectory16( LPCSTR path )
{
return (BOOL16)RemoveDirectoryA( path );
}
/***********************************************************************
* RemoveDirectoryW (KERNEL32.@)
*/
BOOL WINAPI RemoveDirectoryW( LPCWSTR path )
......
......@@ -787,18 +787,6 @@ WCHAR *DRIVE_BuildEnv(void)
/***********************************************************************
* GetDiskFreeSpace (KERNEL.422)
*/
BOOL16 WINAPI GetDiskFreeSpace16( LPCSTR root, LPDWORD cluster_sectors,
LPDWORD sector_bytes, LPDWORD free_clusters,
LPDWORD total_clusters )
{
return GetDiskFreeSpaceA( root, cluster_sectors, sector_bytes,
free_clusters, total_clusters );
}
/***********************************************************************
* GetDiskFreeSpaceW (KERNEL32.@)
*
* Fails if expression resulting from current drive's dir and "root"
......@@ -1029,26 +1017,6 @@ BOOL WINAPI GetDiskFreeSpaceExA( LPCSTR root, PULARGE_INTEGER avail,
}
/***********************************************************************
* GetDriveType (KERNEL.136)
* This function returns the type of a drive in Win16.
* Note that it returns DRIVE_REMOTE for CD-ROMs, since MSCDEX uses the
* remote drive API. The return value DRIVE_REMOTE for CD-ROMs has been
* verified on Win 3.11 and Windows 95. Some programs rely on it, so don't
* do any pseudo-clever changes.
*
* RETURNS
* drivetype DRIVE_xxx
*/
UINT16 WINAPI GetDriveType16( UINT16 drive ) /* [in] number (NOT letter) of drive */
{
UINT type = DRIVE_GetType(drive);
TRACE("(%c:)\n", 'A' + drive );
if (type == DRIVE_CDROM) type = DRIVE_REMOTE;
return type;
}
/***********************************************************************
* GetDriveTypeW (KERNEL32.@)
*
* Returns the type of the disk drive specified. If root is NULL the
......@@ -1176,15 +1144,6 @@ UINT WINAPI GetCurrentDirectoryA( UINT buflen, LPSTR buf )
/***********************************************************************
* SetCurrentDirectory (KERNEL.412)
*/
BOOL16 WINAPI SetCurrentDirectory16( LPCSTR dir )
{
return SetCurrentDirectoryA( dir );
}
/***********************************************************************
* SetCurrentDirectoryW (KERNEL32.@)
*/
BOOL WINAPI SetCurrentDirectoryW( LPCWSTR dir )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment