mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-15 02:44:46 +00:00
5819953c2a
Wed Apr 20 14:53:35 1994 Bob Amstadt (bob@pooh) * [tools/build.c] [if1632/call.S] [if1632/Imakefile] Fixed bug for non-Linux systems. Apr 18, 94 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte) * [windows/win.c] Bug fixed in CreateWindowEx() : Now use SetMenu() for menubar setup. New empty stub for function SetSysModalWindow(). * [misc/exec.c] New empty stub for function ExitWindows(). * [objects/font.c] New empty stub for function EnumFonts(). * New file [misc/property.c] New functions RemoveProp(), GetProp(), SetProp() & EnumProps(). * New file [misc/shell.c] New empty stubs for function RegisterShellProc(), ShellExecute() & ShellProc(). * New files [loader/task.c] & [include/task.h] Move functions GetWindowTask(), GetNumTask(), EnumTaskWindows() from 'loader/library.c'. * [if1632/user.c] [if1632/kernel.c] Put Atoms functions entries. * [controls/combo.c] New functions DirDlgSelectComboBox() & DirDlgListComboBox(). * [controls/listbox.c] New functions DirDlgSelect() & DirDlgList(). Sun Apr 17 20:57:59 1994 Erik Bos (erik@trashcan.hacktic.nl) * [objects/test.c] GrayString() added. * [if1632/callback.c] CallGrayStringProc() added. * [if1632/relay.c] [if1632/mmsystem.spec] Added. * [if1632/kernel.spec] [if1632/user.spec] Added forgotten specs for atom functions. Tue Apr 12 00:05:31 1994 Bob Amstadt (bob@pooh) * misc/spy.c (SpyInit): Added more message types * [windows/mdi.c] [include/mdi.h] Maximizing and restoring child windows. Tiling of child windows. Mon Apr 11 20:48:28 1994 Alexandre Julliard (julliard@lamisun.epfl.ch) * [windows/winpos.c] Revert focus and activation to previous window when hiding a window. * [windows/syscolor.c] Implemented system color objects (brushes and pens created at SetSysColor() time for better performance). * [windows/graphics.c] [windows/nonclient.c] [controls/button.c] Changed painting code to use system color objects. * [windows/message.c] New function MSG_InternalGetMessage() for internal messages loops (e.g. for dialogs or menus). * [windows/hook.c] [include/hook.h] (New files) Beginning of the window hooks implementation. * [windows/dialog.c] Use new function MSG_InternalGetMessage() in DialogBox(). * [if1632/callback.c] Added function CallHookProc(). Apr 11, 94 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte) * [windows/event.c] Bug fix : WM_CHARs are sent to focused window like WM_KEY???. * [misc/exec.c] Nothing much more than a stub for LoadModule(), I saw there a lot to be done in that corner, I will come back later ... * [loader/library.c] New functions GetWindowTask(), GetNumTask(), EnumTaskWindows() and associated modules & tasks linked-lists. (it's only an 'emerging bud', more to come next weeks). * [loader/wine.c] Use LoadLibrary() instead of LoadImage() for 'sysres.dll'. * [control/menu.c] You can now click outside menu region without problem. Keyboard navig more smootly, even if a child has the focus. Bug fix in InsertItem(), (bad linklist when insert point not found). change Realloc for Free & Alloc in ModifyItem(). MF_STRING now set BLACK_PEN to fix bug of bad color of the underscores done by DrawText(), (maybe it should done in DrawText() itself ?). Sun Apr 10 14:06:08 1994 Erik Bos (erik@trashcan.hacktic.nl) * [misc/profile.c] .INI files will now be stored in / loaded from the windows dir if no path is supplied. * [if1632/kernel.spec] Fixed GetDriveType's prototype. * [if1632/winsock.spec] [include/winsock.h] [misc/winsocket.c] Fixed prototypes: winsock uses a word as socket handle not an int. * [misc/winsocket.c] Added heap allocation for returned structures. Added non-blocking WSAAsyncGetXbyY() functions as blocking ones. * [loader/wine.c] Added IsDLLLoaded(), used in LoadImage() to prevent loading a dll multiple times. Directory is added to wine's path when a fullpath is supplied when starting wine. LoadImage(): DLL filename used instead DLL's own internal name, fixes 'Bad DLL name' errors. Sat Apr 9 08:26:03 1994 David Metcalfe <david@prism.demon.co.uk> * [controls/edit.c] [controls/widgets.c] First release of edit control.
330 lines
8.7 KiB
C
330 lines
8.7 KiB
C
/************************************************************************
|
|
* FILE.C Copyright (C) 1993 John Burton
|
|
*
|
|
* File I/O routines for the Linux Wine Project.
|
|
*
|
|
* WARNING : Many options of OpenFile are not yet implemeted.
|
|
*
|
|
* NOV 93 Erik Bos (erik@(trashcan.)hacktic.nl
|
|
* - removed ParseDosFileName, and DosDrive structures.
|
|
* - structures dynamically configured at runtime.
|
|
* - _lopen modified to use GetUnixFileName.
|
|
*
|
|
* DEC 93 Erik Bos (erik@(trashcan.)hacktic.nl)
|
|
* - Existing functions modified to use dosfs functions.
|
|
* - Added _llseek, _lcreate, GetDriveType, GetTempDrive,
|
|
* GetWindowsDirectory, GetSystemDirectory, GetTempFileName.
|
|
*
|
|
************************************************************************/
|
|
|
|
/* #define DEBUG_FILE */
|
|
|
|
#include <stdio.h>
|
|
#include <fcntl.h>
|
|
#include <limits.h>
|
|
#include <unistd.h>
|
|
#include <time.h>
|
|
#include <windows.h>
|
|
#include "prototypes.h"
|
|
|
|
char WindowsDirectory[256], SystemDirectory[256], TempDirectory[256];
|
|
|
|
/***************************************************************************
|
|
_lopen
|
|
|
|
Emulate the _lopen windows call
|
|
***************************************************************************/
|
|
INT _lopen (LPSTR lpPathName, INT iReadWrite)
|
|
{
|
|
int handle;
|
|
char *UnixFileName;
|
|
|
|
#ifdef DEBUG_FILE
|
|
fprintf (stderr, "_lopen: open('%s', %X);\n", lpPathName, iReadWrite);
|
|
#endif
|
|
|
|
if ((UnixFileName = GetUnixFileName(lpPathName)) == NULL)
|
|
return HFILE_ERROR;
|
|
iReadWrite &= 0x000F;
|
|
handle = open (UnixFileName, iReadWrite);
|
|
|
|
#ifdef DEBUG_FILE
|
|
fprintf (stderr, "_lopen: open: %s (handle %d)\n", UnixFileName, handle);
|
|
#endif
|
|
|
|
if (handle == -1)
|
|
return HFILE_ERROR;
|
|
else
|
|
return handle;
|
|
}
|
|
|
|
/***************************************************************************
|
|
_lread
|
|
***************************************************************************/
|
|
WORD _lread (INT hFile, LPSTR lpBuffer, INT wBytes)
|
|
{
|
|
int result;
|
|
|
|
#ifdef DEBUG_FILE
|
|
fprintf(stderr, "_lread: handle %d, buffer = %ld, length = %d\n",
|
|
hFile, (int) lpBuffer, wBytes);
|
|
#endif
|
|
|
|
result = read (hFile, lpBuffer, wBytes);
|
|
|
|
if (result == -1)
|
|
return HFILE_ERROR;
|
|
else
|
|
return result;
|
|
}
|
|
|
|
/****************************************************************************
|
|
_lwrite
|
|
****************************************************************************/
|
|
WORD _lwrite (INT hFile, LPSTR lpBuffer, INT wBytes)
|
|
{
|
|
int result;
|
|
|
|
#ifdef DEBUG_FILE
|
|
fprintf(stderr, "_lwrite: handle %d, buffer = %ld, length = %d\n",
|
|
hFile, (int) lpBuffer, wBytes);
|
|
#endif
|
|
result = write (hFile, lpBuffer, wBytes);
|
|
|
|
if (result == -1)
|
|
return HFILE_ERROR;
|
|
else
|
|
return result;
|
|
}
|
|
|
|
/***************************************************************************
|
|
_lclose
|
|
***************************************************************************/
|
|
INT _lclose (INT hFile)
|
|
{
|
|
#ifdef DEBUG_FILE
|
|
fprintf(stderr, "_lclose: handle %d\n", hFile);
|
|
#endif
|
|
if (close (hFile))
|
|
return HFILE_ERROR;
|
|
else
|
|
return 0;
|
|
}
|
|
|
|
/**************************************************************************
|
|
OpenFile
|
|
|
|
Warning: This is nearly totally untested. It compiles, that's it...
|
|
-SL 9/13/93
|
|
**************************************************************************/
|
|
INT OpenFile (LPSTR lpFileName, LPOFSTRUCT ofs, WORD wStyle)
|
|
{
|
|
int base,flags;
|
|
|
|
#ifdef DEBUG_FILE
|
|
fprintf(stderr,"Openfile(%s,<struct>,%d) ",lpFileName,wStyle);
|
|
#endif
|
|
|
|
base=wStyle&0xF;
|
|
flags=wStyle&0xFFF0;
|
|
|
|
flags&=0xFF0F; /* strip SHARE bits for now */
|
|
flags&=0xD7FF; /* strip PROMPT & CANCEL bits for now */
|
|
flags&=0x7FFF; /* strip REOPEN bit for now */
|
|
flags&=0xFBFF; /* strib VERIFY bit for now */
|
|
|
|
if(flags&OF_CREATE) { base |=O_CREAT; flags &=0xEFFF; }
|
|
|
|
fprintf(stderr,"now %d,%d\n",base,flags);
|
|
|
|
if(flags&(OF_DELETE|OF_EXIST))
|
|
{
|
|
fprintf(stderr,"Unsupported OpenFile option\n");
|
|
return -1;
|
|
}
|
|
else
|
|
{
|
|
return _lopen (lpFileName, wStyle);
|
|
}
|
|
}
|
|
|
|
/**************************************************************************
|
|
SetHandleCount
|
|
|
|
Changes the number of file handles available to the application. Since
|
|
Linux isn't limited to 20 files, this one's easy. - SL
|
|
**************************************************************************/
|
|
|
|
#if !defined (OPEN_MAX)
|
|
/* This one is for the Sun */
|
|
#define OPEN_MAX _POSIX_OPEN_MAX
|
|
#endif
|
|
WORD SetHandleCount (WORD wNumber)
|
|
{
|
|
printf("SetHandleCount(%d)\n",wNumber);
|
|
return((wNumber<OPEN_MAX) ? wNumber : OPEN_MAX);
|
|
}
|
|
|
|
/***************************************************************************
|
|
_llseek
|
|
***************************************************************************/
|
|
LONG _llseek (INT hFile, LONG lOffset, INT nOrigin)
|
|
{
|
|
int origin;
|
|
|
|
#ifdef DEBUG_FILE
|
|
fprintf(stderr, "_llseek: handle %d, offset %ld, origin %d\n", hFile, lOffset, nOrigin);
|
|
#endif
|
|
|
|
switch (nOrigin) {
|
|
case 1: origin = SEEK_CUR;
|
|
break;
|
|
case 2: origin = SEEK_END;
|
|
break;
|
|
default: origin = SEEK_SET;
|
|
break;
|
|
}
|
|
|
|
return ( lseek(hFile, lOffset, origin) );
|
|
}
|
|
|
|
/***************************************************************************
|
|
_lcreate
|
|
***************************************************************************/
|
|
INT _lcreate (LPSTR lpszFilename, INT fnAttribute)
|
|
{
|
|
int handle;
|
|
char *UnixFileName;
|
|
|
|
#ifdef DEBUG_FILE
|
|
fprintf(stderr, "_lcreate: filename %s, attributes %d\n",lpszFilename,
|
|
fnAttribute);
|
|
#endif
|
|
|
|
if ((UnixFileName = GetUnixFileName(lpszFilename)) == NULL)
|
|
return HFILE_ERROR;
|
|
|
|
handle = open (UnixFileName, O_CREAT | O_TRUNC | O_WRONLY );
|
|
|
|
if (handle == -1)
|
|
return HFILE_ERROR;
|
|
else
|
|
return handle;
|
|
}
|
|
|
|
/***************************************************************************
|
|
GetDriveType
|
|
***************************************************************************/
|
|
UINT GetDriveType(INT drive)
|
|
{
|
|
|
|
#ifdef DEBUG_FILE
|
|
fprintf(stderr,"GetDriveType %c:\n",'A'+drive);
|
|
#endif
|
|
|
|
if (!DOS_ValidDrive(drive))
|
|
return DRIVE_DOESNOTEXIST;
|
|
|
|
if (drive == 0 || drive == 1)
|
|
return DRIVE_REMOVABLE;
|
|
|
|
return DRIVE_FIXED;
|
|
}
|
|
|
|
/***************************************************************************
|
|
GetTempDrive
|
|
***************************************************************************/
|
|
BYTE GetTempDrive(BYTE chDriveLetter)
|
|
{
|
|
#ifdef DEBUG_FILE
|
|
fprintf(stderr,"GetTempDrive (%d)\n",chDriveLetter);
|
|
#endif
|
|
return('C');
|
|
}
|
|
|
|
/***************************************************************************
|
|
GetWindowsDirectory
|
|
***************************************************************************/
|
|
UINT GetWindowsDirectory(LPSTR lpszSysPath, UINT cbSysPath)
|
|
{
|
|
if (cbSysPath < strlen(WindowsDirectory))
|
|
*lpszSysPath = 0;
|
|
else
|
|
strcpy(lpszSysPath, WindowsDirectory);
|
|
|
|
#ifdef DEBUG_FILE
|
|
fprintf(stderr,"GetWindowsDirectory (%s)\n",lpszSysPath);
|
|
#endif
|
|
|
|
ChopOffSlash(lpszSysPath);
|
|
return(strlen(lpszSysPath));
|
|
}
|
|
/***************************************************************************
|
|
GetSystemDirectory
|
|
***************************************************************************/
|
|
UINT GetSystemDirectory(LPSTR lpszSysPath, UINT cbSysPath)
|
|
{
|
|
if (cbSysPath < strlen(SystemDirectory))
|
|
*lpszSysPath = 0;
|
|
else
|
|
strcpy(lpszSysPath, SystemDirectory);
|
|
|
|
#ifdef DEBUG_FILE
|
|
fprintf(stderr,"GetSystemDirectory (%s)\n",lpszSysPath);
|
|
#endif
|
|
|
|
ChopOffSlash(lpszSysPath);
|
|
return(strlen(lpszSysPath));
|
|
}
|
|
/***************************************************************************
|
|
GetTempFileName
|
|
***************************************************************************/
|
|
INT GetTempFileName(BYTE bDriveLetter, LPCSTR lpszPrefixString, UINT uUnique, LPSTR lpszTempFileName)
|
|
{
|
|
int unique;
|
|
char tempname[256];
|
|
|
|
if (uUnique == 0)
|
|
unique = time(NULL)%99999L;
|
|
else
|
|
unique = uUnique%99999L;
|
|
|
|
strcpy(tempname,lpszPrefixString);
|
|
tempname[3]='\0';
|
|
|
|
sprintf(lpszTempFileName,"%s\\%s%d.tmp", TempDirectory, tempname,
|
|
unique);
|
|
|
|
ToDos(lpszTempFileName);
|
|
|
|
#ifdef DEBUG_FILE
|
|
fprintf(stderr,"GetTempFilename: %c %s %d => %s\n",bDriveLetter,
|
|
lpszPrefixString,uUnique,lpszTempFileName);
|
|
#endif
|
|
|
|
return unique;
|
|
}
|
|
|
|
/***************************************************************************
|
|
SetErrorMode
|
|
***************************************************************************/
|
|
WORD SetErrorMode(WORD x)
|
|
{
|
|
fprintf(stderr,"wine: SetErrorMode %4x (ignored)\n",x);
|
|
}
|
|
|
|
/***************************************************************************
|
|
_hread
|
|
***************************************************************************/
|
|
long _hread(int hf, void FAR *hpvBuffer, long cbBuffer)
|
|
{
|
|
return read(hf, hpvBuffer, cbBuffer);
|
|
}
|
|
/***************************************************************************
|
|
_hwrite
|
|
***************************************************************************/
|
|
long _hwrite(int hf, const void FAR *hpvBuffer, long cbBuffer)
|
|
{
|
|
return write(hf, hpvBuffer, cbBuffer);
|
|
}
|