Release 951212
Mon Dec 11 19:08:55 1995 Alexandre Julliard <julliard@sunsite.unc.edu>
* [misc/lstr.c]
Replaced wine_strncpy() by a 32-bit version of lstrcpyn(), since
they do the same job.
* [tools/build.c]
Fixed __attribute__((stdcall)) to make it compile with gcc
versions under 2.7. Doesn't mean it will run OK though...
Sat Dec 09 13:22:58 1995 Cameron Heide <heide@ee.ualberta.ca>
* [include/kernel32.h] [include/winerror.h]
Added file attribute definitions and more error codes.
* [win32/error.c]
Added some rudimentary errno-to-Win32 error conversion
code.
* [win32/file.c]
Added to GetFileInformationByHandle, filled in some known
error codes, and switched to dprintf_win32.
* [win32/time.c]
Added GetLocalTime.
Fri Dec 8 14:37:39 1995 Jim Peterson <jspeter@birch.ee.vt.edu>
* [controls/combo.c]
Converted functions of the type LONG _(HWND,WORD,LONG) to the type
LRESULT _(HWND,WPARAM,LPARAM) where needed.
* [include/libres.h]
Restructured libres prototypes to closer match the windows API.
* [include/windows.h]
Changed several API prototypes' parameter types from 'short' to INT,
which is #defined as short in the emulator, but is a normal int in
WINELIB32. Also changed SEGPTR from DWORD to void* when WINELIB32.
(This creates a lot of warnings at library-compile time, but less
warnings at app-compile time. I'll remove the warnings soon.)
* [loader/resource.c]
Fixed parameter mismatch in call to LIBRES_FindResource(). Changed
various implementations of the LIBRES_* API functions.
* [loader/signal.c]
Deleted local 'i' from win_fault(), since it was unused.
* [objects/bitblt.c]
Mirrored changes to include/windows.h mentioned above.
* [toolkit/hello3.c]
Changed LoadMenuIndirect() call to LoadMenu() to test the new
resource registration technique.
* [toolkit/libres.c]
Removed definition of 'struct resource' and fixed bugs in the resource
implementation. Implemented LIBRES_FindResource.
* [windows/graphics.c]
Mirrored changes to include/windows.h mentioned above.
Thu Dec 7 23:15:56 1995 Martin von Loewis <loewis@informatik.hu-berlin.de>
* [controls/edit.c]
LOCAL_HeapExists: Changed parameter to HANDLE. For WineLib, return true
* [controls/listbox.c]
CreateListBoxStruct: Initialize HeapSel to 0 for WineLib
* [include/listbox.h]
change HeapSel from WORD to HANDLE
* [include/resource.h][rc/winerc.c]
struct ResourceTable: removed
struct resource: moved to header file
autoregister resources if supported by compiler
* [memory/local.h]
LOCAL_GetHeap: expect HANDLE rather than WORD
* [toolkit/Makefile.in]
Add ALLCFLAGS to make hello3
* [toolkit/heap.c]
LocalFree, HEAP_Free: handle 0 parameter gracefully
Wed Dec 06 15:34:23 1995 Greg Cooper <cooper@ima-inc.com>
* [misc/winsocket.c]
Fixed the msgsnd and msgrcv errors that winsock programs get.
Wed Dec 06 12:47:23 MET 1995 Sven Verdoolaege <skimo@dns.ufsia.ac.be>
* [if1632/kernel.spec]
Fixed _hread and _hwrite return type
* [if1632/relay32.c] [loader/pe_image.c]
Hacked loading of PE-dll's in
* [win32/advapi.c]
Added stubs for RegCreateKeyEx, RegSetValueEx, RegQueryValueEx
* [win32/file.c]
Added stubs for OpenFileMapping, CreateFileMapping, MapViewOfFileEx
* [win32/process.c]
Added stubs for CreateMutexA, ReleaseMutex, CreateEventA,
WaitForSingleObject, DuplicateHandle, GetCurrentProcess
Mon Dec 04 13:06:37 1995 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de>
* [include/wine.h] [misc/lstr.c]
Define wine_strncpy(). This function does not pad the buffer with
zeroes like GNU strncpy(), which might break some Windows programs
that pass bogus size arguments.
* [loader/module.c]: GetModuleFileName(),
[misc/commdlg.c]: GetFileTitle(),
[misc/keyboard.c], [misc/lstr.c]: lstrcpyn(),
[misc/ole2nls.c], [misc/profile.c], [multimedia/mcistring.c],
[multimedia/mmsystem.c], [objects/font.c]:
Use wine_strncpy() where strings are returned to Windows programs.
* [objects/metafile.c]
PlayMetafile(): Clear the handle table before using it.
* [misc/shell.c] [misc/main.c]
Rename SHELL_RegCheckForRoot() to SHELL_Init() and call it from main().
* [misc/profile.c]
load(): Need to handle comments.
* [toolkit/libres.c]
Make it compile.
* [windows/nonclient.c]
Use MAKE_SEGPTR macro in two places where a user heap block used
to be allocated instead.
Sat Dec 02 16:43:43 1995 Ramon Garcia <ramon@ie3.clubs.etsit.upm.es>
* [windows/winpos.c]
In function SetWindowPos: do not redraw the parent of
a window if the specified window is placed on the top.
This avoids that ShowWindow(hwnd,1) hides hwnd instead
of showing it.
Sat Dec 02 11:00:00 1995 Alex Korobka <alex@phm30.pharm.sunysb.edu>
* [windows/scroll.c]
Now it can scroll children along with the client region of parent
window. Tried to optimize update region calculation.
* [windows/mdi.c]
ScrollChildren function, more other features added. Basically
a rewrite.
* [windows/winpos.c] [windows/focus.c]
Reimplemented window activation and focus handling.
* [windows/nonclient.c]
Added new flag WIN_NCACTIVATED.
* [windows/message.c] [loader/task.c]
Small changes (to maintain linked list of message queues).
Wed Nov 29 15:51:48 1995 Daniel Schepler <daniel@shep13.wustl.edu>
* [include/options.h] [misc/main.c] [windows/defwnd.c]
[windows/event.c] [windows/nonclient.c] [windows/win.c] [Wine.man]
Implemented a -managed option to replace the standard Windows
frame of top-level windows with the window manager's decorations.
If a top-level window makes its own frame, this will still show
up, inside the window manager decorations (I believe ctl3dv2.dll
would do this, although I can't test this).
diff --git a/misc/Makefile.in b/misc/Makefile.in
index 26ac02d..f4c201e 100644
--- a/misc/Makefile.in
+++ b/misc/Makefile.in
@@ -14,12 +14,12 @@
keyboard.c \
lstr.c \
main.c \
+ network.c \
ole2.c \
ole2disp.c \
ole2nls.c \
olecli.c \
olesvr.c \
- network.c \
profile.c \
rect.c \
shell.c \
diff --git a/misc/commdlg.c b/misc/commdlg.c
index 73df1d1..d6c8815 100644
--- a/misc/commdlg.c
+++ b/misc/commdlg.c
@@ -858,29 +858,30 @@
*/
int GetFileTitle(LPCSTR lpFile, LPSTR lpTitle, UINT cbBuf)
{
- int i, len;
- printf("GetFileTitle(%p %p %d); \n", lpFile, lpTitle, cbBuf);
- if (lpFile == NULL || lpTitle == NULL)
- return -1;
- len = strlen(lpFile);
- if (len == 0)
- return -1;
- if (strpbrk(lpFile, "*[]"))
- return -1;
- len--;
- if (lpFile[len] == '/' || lpFile[len] == '\\' || lpFile[len] == ':')
- return -1;
- for (i = len; i >= 0; i--)
- if (lpFile[i] == '/' || lpFile[i] == '\\' || lpFile[i] == ':')
- {
+ int i, len;
+ printf("GetFileTitle(%p %p %d); \n", lpFile, lpTitle, cbBuf);
+ if (lpFile == NULL || lpTitle == NULL)
+ return -1;
+ len = strlen(lpFile);
+ if (len == 0)
+ return -1;
+ if (strpbrk(lpFile, "*[]"))
+ return -1;
+ len--;
+ if (lpFile[len] == '/' || lpFile[len] == '\\' || lpFile[len] == ':')
+ return -1;
+ for (i = len; i >= 0; i--)
+ if (lpFile[i] == '/' || lpFile[i] == '\\' || lpFile[i] == ':')
+ {
i++;
break;
- }
- printf("\n---> '%s' ", &lpFile[i]);
- len = MIN(cbBuf, strlen(&lpFile[i]) + 1);
- strncpy(lpTitle, &lpFile[i], len + 1);
- if (len != cbBuf)
- return len;
- else
+ }
+ printf("\n---> '%s' ", &lpFile[i]);
+
+ len = strlen(lpFile+i)+1;
+ if (cbBuf < len);
+ return len;
+
+ strncpy(lpTitle, &lpFile[i], len);
return 0;
}
diff --git a/misc/dos_fs.c b/misc/dos_fs.c
index 28cdf30..0d88d8f 100644
--- a/misc/dos_fs.c
+++ b/misc/dos_fs.c
@@ -885,12 +885,6 @@
strcpy(dp->unixpath, dirname);
dp->entnum = 0;
- if ((dp->telldirnum=telldir(ds)) == -1)
- {
- dp->inuse = 0;
- closedir(ds);
- return NULL;
- }
if (closedir(ds) == -1)
{
dp->inuse = 0;
@@ -906,11 +900,16 @@
struct dirent *d;
struct stat st;
DIR *ds;
+ int i;
if (!de->inuse)
return NULL;
if (!(ds=opendir(de->unixpath))) return NULL;
- seekdir(ds,de->telldirnum); /* returns no error value. strange */
+ /* skip all already read directory entries.
+ * the dir has hopefully not been modified in the meantime
+ */
+ for (i=de->entnum;i--;)
+ readdir(ds);
if (de->search_attribute & FA_LABEL) {
int drive;
@@ -927,13 +926,11 @@
}
do {
+ de->entnum++; /* Increment the directory entry number */
if ((d = readdir(ds)) == NULL) {
- de->telldirnum=telldir(ds);
closedir(ds);
return NULL;
}
-
- de->entnum++; /* Increment the directory entry number */
strcpy(de->filename, d->d_name);
if (d->d_reclen > 12)
de->filename[12] = '\0';
@@ -954,7 +951,6 @@
de->filesize = st.st_size;
de->filetime = st.st_mtime;
- de->telldirnum = telldir(ds);
closedir(ds);
return de;
}
diff --git a/misc/keyboard.c b/misc/keyboard.c
index ce2c0ec..8058a7c 100644
--- a/misc/keyboard.c
+++ b/misc/keyboard.c
@@ -124,7 +124,7 @@
for (i = 0 ; i != KeyTableSize ; i++)
if (KeyTable[i].scancode == lParam) {
- strncpy(lpBuffer, KeyTable[i].name, nSize);
+ lstrcpyn(lpBuffer, KeyTable[i].name, nSize);
return strlen(lpBuffer);
}
diff --git a/misc/lstr.c b/misc/lstr.c
index b79c3b3..5d03363 100644
--- a/misc/lstr.c
+++ b/misc/lstr.c
@@ -54,7 +54,6 @@
"\205\240\203\141\204\206\221\207\212\202\210\211\215\241\214\213"
"\144\244\225\242\223\157\224\366\157\227\243\226\201\171\137\230";
-
/* Funny to divide them between user and kernel. */
/* KERNEL.89 */
@@ -87,10 +86,20 @@
return target;
}
-/* KERNEL.353 */
-SEGPTR lstrcpyn( SEGPTR target, SEGPTR source, WORD n )
+/* KERNEL.353 32-bit version*/
+char *lstrcpyn(char *dst, char *src, int n)
{
- strncpy((char *)PTR_SEG_TO_LIN(target), (char *)PTR_SEG_TO_LIN(source), n);
+ char *tmp = dst;
+ while(n-- > 1 && *src)
+ *dst++ = *src++;
+ *dst = 0;
+ return tmp;
+}
+
+/* KERNEL.353 16-bit version*/
+SEGPTR WIN16_lstrcpyn( SEGPTR target, SEGPTR source, WORD n )
+{
+ lstrcpyn((char *)PTR_SEG_TO_LIN(target), (char *)PTR_SEG_TO_LIN(source),n);
return target;
}
diff --git a/misc/main.c b/misc/main.c
index 8f2a426..9226c08 100644
--- a/misc/main.c
+++ b/misc/main.c
@@ -23,6 +23,7 @@
#include "winsock.h"
#include "options.h"
#include "desktop.h"
+#include "shell.h"
#include "dlls.h"
#define DEBUG_DEFINE_VARIABLES
#include "stddebug.h"
@@ -89,11 +90,11 @@
FALSE, /* Enhanced mode */
FALSE, /* IPC enabled */
#ifdef DEFAULT_LANG
- DEFAULT_LANG /* Default language */
+ DEFAULT_LANG, /* Default language */
#else
- LANG_En
+ LANG_En,
#endif
-
+ FALSE /* Managed windows */
};
@@ -114,7 +115,8 @@
{ "-debugmsg", ".debugmsg", XrmoptionSepArg, (caddr_t)NULL },
{ "-dll", ".dll", XrmoptionSepArg, (caddr_t)NULL },
{ "-allowreadonly", ".allowreadonly", XrmoptionNoArg, (caddr_t)"on" },
- { "-enhanced", ".enhanced", XrmoptionNoArg, (caddr_t)"off"}
+ { "-enhanced", ".enhanced", XrmoptionNoArg, (caddr_t)"off"},
+ { "-managed", ".managed", XrmoptionNoArg, (caddr_t)"off"}
};
#define NB_OPTIONS (sizeof(optionsTable) / sizeof(optionsTable[0]))
@@ -130,6 +132,7 @@
" -ipc Enable IPC facilities\n" \
" -debug Enter debugger before starting application\n" \
" -language xx Set the language (one of En,Es,De,No,Fr,Fi,Da)\n" \
+ " -managed Allow the window manager to manage created windows\n" \
" -name name Set the application name\n" \
" -privatemap Use a private color map\n" \
" -fixedmap Use a \"standard\" color map\n" \
@@ -373,6 +376,8 @@
Options.desktopGeometry = value.addr;
if (MAIN_GetResource( db, ".language", &value))
MAIN_ParseLanguageOption( (char *)value.addr );
+ if (MAIN_GetResource( db, ".managed", &value))
+ Options.managed = TRUE;
#ifdef DEBUG_RUNTIME
if (MAIN_GetResource( db, ".debugoptions", &value))
ParseDebugOptions((char*)value.addr);
@@ -530,7 +535,6 @@
static void called_at_exit(void)
{
extern void sync_profiles(void);
- extern void SHELL_SaveRegistry(void);
sync_profiles();
MAIN_RestoreSetup();
@@ -548,7 +552,6 @@
int *depth_list;
extern int _WinMain(int argc, char **argv);
- extern void SHELL_LoadRegistry(void);
setbuf(stdout,NULL);
setbuf(stderr,NULL);
@@ -575,6 +578,7 @@
}
#endif
+ SHELL_Init();
SHELL_LoadRegistry();
screen = DefaultScreenOfDisplay( display );
@@ -652,66 +656,67 @@
*/
int SetEnvironment(LPSTR lpPortName, LPSTR lpEnviron, WORD nCount)
{
- LPENVENTRY lpNewEnv;
- LPENVENTRY lpEnv = lpEnvList;
- dprintf_env(stddeb, "SetEnvironnement('%s', '%s', %d) !\n",
- lpPortName, lpEnviron, nCount);
- if (lpPortName == NULL) return -1;
- while (lpEnv != NULL) {
- if (lpEnv->Name != NULL && strcmp(lpEnv->Name, lpPortName) == 0) {
- if (nCount == 0 || lpEnviron == NULL) {
- if (lpEnv->Prev != NULL) lpEnv->Prev->Next = lpEnv->Next;
- if (lpEnv->Next != NULL) lpEnv->Next->Prev = lpEnv->Prev;
- free(lpEnv->Value);
- free(lpEnv->Name);
- free(lpEnv);
- dprintf_env(stddeb, "SetEnvironnement() // entry deleted !\n");
- return -1;
- }
- free(lpEnv->Value);
- lpEnv->Value = malloc(nCount);
- if (lpEnv->Value == NULL) {
- dprintf_env(stddeb, "SetEnvironment() // Error allocating entry value !\n");
- return 0;
- }
- memcpy(lpEnv->Value, lpEnviron, nCount);
- lpEnv->wSize = nCount;
- dprintf_env(stddeb, "SetEnvironnement() // entry modified !\n");
- return nCount;
- }
- if (lpEnv->Next == NULL) break;
- lpEnv = lpEnv->Next;
- }
- if (nCount == 0 || lpEnviron == NULL) return -1;
- dprintf_env(stddeb, "SetEnvironnement() // new entry !\n");
- lpNewEnv = malloc(sizeof(ENVENTRY));
- if (lpNewEnv == NULL) {
- dprintf_env(stddeb, "SetEnvironment() // Error allocating new entry !\n");
- return 0;
- }
- if (lpEnvList == NULL) {
- lpEnvList = lpNewEnv;
- lpNewEnv->Prev = NULL;
- }
- else {
- lpEnv->Next = lpNewEnv;
- lpNewEnv->Prev = lpEnv;
- }
- lpNewEnv->Next = NULL;
- lpNewEnv->Name = malloc(strlen(lpPortName) + 1);
- if (lpNewEnv->Name == NULL) {
- dprintf_env(stddeb, "SetEnvironment() // Error allocating entry name !\n");
- return 0;
- }
- strcpy(lpNewEnv->Name, lpPortName);
- lpNewEnv->Value = malloc(nCount);
- if (lpNewEnv->Value == NULL) {
+ LPENVENTRY lpNewEnv;
+ LPENVENTRY lpEnv = lpEnvList;
+ dprintf_env(stddeb, "SetEnvironment('%s', '%s', %d) !\n",
+ lpPortName, lpEnviron, nCount);
+ if (lpPortName == NULL) return -1;
+ while (lpEnv != NULL) {
+ if (lpEnv->Name != NULL && strcmp(lpEnv->Name, lpPortName) == 0) {
+ if (nCount == 0 || lpEnviron == NULL) {
+ if (lpEnv->Prev != NULL) lpEnv->Prev->Next = lpEnv->Next;
+ if (lpEnv->Next != NULL) lpEnv->Next->Prev = lpEnv->Prev;
+ free(lpEnv->Value);
+ free(lpEnv->Name);
+ free(lpEnv);
+ dprintf_env(stddeb, "SetEnvironment() // entry deleted !\n");
+ return -1;
+ }
+ free(lpEnv->Value);
+ lpEnv->Value = malloc(nCount);
+ if (lpEnv->Value == NULL) {
dprintf_env(stddeb, "SetEnvironment() // Error allocating entry value !\n");
return 0;
- }
- memcpy(lpNewEnv->Value, lpEnviron, nCount);
- lpNewEnv->wSize = nCount;
- return nCount;
+ }
+ memcpy(lpEnv->Value, lpEnviron, nCount);
+ lpEnv->wSize = nCount;
+ dprintf_env(stddeb, "SetEnvironment() // entry modified !\n");
+ return nCount;
+ }
+ if (lpEnv->Next == NULL) break;
+ lpEnv = lpEnv->Next;
+ }
+ if (nCount == 0 || lpEnviron == NULL) return -1;
+ dprintf_env(stddeb, "SetEnvironment() // new entry !\n");
+ lpNewEnv = malloc(sizeof(ENVENTRY));
+ if (lpNewEnv == NULL) {
+ dprintf_env(stddeb, "SetEnvironment() // Error allocating new entry !\n");
+ return 0;
+ }
+ if (lpEnvList == NULL) {
+ lpEnvList = lpNewEnv;
+ lpNewEnv->Prev = NULL;
+ }
+ else
+ {
+ lpEnv->Next = lpNewEnv;
+ lpNewEnv->Prev = lpEnv;
+ }
+ lpNewEnv->Next = NULL;
+ lpNewEnv->Name = malloc(strlen(lpPortName) + 1);
+ if (lpNewEnv->Name == NULL) {
+ dprintf_env(stddeb, "SetEnvironment() // Error allocating entry name !\n");
+ return 0;
+ }
+ strcpy(lpNewEnv->Name, lpPortName);
+ lpNewEnv->Value = malloc(nCount);
+ if (lpNewEnv->Value == NULL) {
+ dprintf_env(stddeb, "SetEnvironment() // Error allocating entry value !\n");
+ return 0;
+ }
+ memcpy(lpNewEnv->Value, lpEnviron, nCount);
+ lpNewEnv->wSize = nCount;
+ return nCount;
}
/***********************************************************************
@@ -730,21 +735,21 @@
*/
int GetEnvironment(LPSTR lpPortName, LPSTR lpEnviron, WORD nMaxSiz)
{
- WORD nCount;
- LPENVENTRY lpEnv = lpEnvList;
- dprintf_env(stddeb, "GetEnvironnement('%s', '%s', %d) !\n",
- lpPortName, lpEnviron, nMaxSiz);
- while (lpEnv != NULL) {
- if (lpEnv->Name != NULL && strcmp(lpEnv->Name, lpPortName) == 0) {
- nCount = MIN(nMaxSiz, lpEnv->wSize);
- memcpy(lpEnviron, lpEnv->Value, nCount);
- dprintf_env(stddeb, "GetEnvironnement() // found '%s' !\n", lpEnviron);
- return nCount;
- }
- lpEnv = lpEnv->Next;
- }
- dprintf_env(stddeb, "GetEnvironnement() // not found !\n");
- return 0;
+ WORD nCount;
+ LPENVENTRY lpEnv = lpEnvList;
+ dprintf_env(stddeb, "GetEnvironment('%s', '%s', %d) !\n",
+ lpPortName, lpEnviron, nMaxSiz);
+ while (lpEnv != NULL) {
+ if (lpEnv->Name != NULL && strcmp(lpEnv->Name, lpPortName) == 0) {
+ nCount = MIN(nMaxSiz, lpEnv->wSize);
+ memcpy(lpEnviron, lpEnv->Value, nCount);
+ dprintf_env(stddeb, "GetEnvironment() // found '%s' !\n", lpEnviron);
+ return nCount;
+ }
+ lpEnv = lpEnv->Next;
+ }
+ dprintf_env(stddeb, "GetEnvironment() // not found !\n");
+ return 0;
}
/***********************************************************************
diff --git a/misc/ole2nls.c b/misc/ole2nls.c
index f0dc52f..0a20cf9 100644
--- a/misc/ole2nls.c
+++ b/misc/ole2nls.c
@@ -432,7 +432,7 @@
}
if(retLen>len)retLen=len;
- strncpy(buf,retString,len);
+ lstrcpyn(buf,retString,len);
return retLen;
}
diff --git a/misc/profile.c b/misc/profile.c
index 080c3dc..043eb28 100644
--- a/misc/profile.c
+++ b/misc/profile.c
@@ -14,9 +14,7 @@
* has a NULL KeyValue returning a list of KeyNames, and a NULL
* AppName undefined. I changed GetSetProfile to match. This makes
* PROGMAN.EXE do the right thing.
- *
-static char Copyright [] = "Copyright (C) 1993 Miguel de Icaza";
-*/
+ */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -25,15 +23,12 @@
#include "wine.h"
#include "windows.h"
#include "dos_fs.h"
-#include "module.h"
#include "toolhelp.h"
#include "stddebug.h"
-/* #define DEBUG_PROFILE */
#include "debug.h"
#include "xmalloc.h"
#define STRSIZE 255
-#define overflow (next == &CharBuffer [STRSIZE-1])
typedef struct TKeys {
char *KeyName;
@@ -143,7 +138,12 @@
if (isspace(c))
continue;
-
+ if (c == ';') {
+ do {
+ c = fgetc(f);
+ } while (!(c == EOF || c == '\n'));
+ if (c == EOF) goto finished;
+ }
if (c == '[') {
TSecHeader *temp = SecHeader;
@@ -206,23 +206,26 @@
skipspc = TRUE;
do {
c = fgetc(f);
- if (c == EOF) break;
- if (c != '\n') {
- if (!isspace(c) || !skipspc) {
- skipspc = FALSE;
- bufsize++;
- *bufptr++ = c;
- if (!isspace(c))
- lastnonspc = bufptr;
- }
- } else
- break;
+ if (c == EOF || c == '\n' || c == ';') break;
+ if (!isspace(c) || !skipspc) {
+ skipspc = FALSE;
+ bufsize++;
+ *bufptr++ = c;
+ if (!isspace(c))
+ lastnonspc = bufptr;
+ }
} while(bufsize < STRSIZE-1);
*lastnonspc = 0;
SecHeader->Keys->Value = strdup (CharBuffer);
dprintf_profile (stddeb, "[%s] (%s)=%s\n", SecHeader->AppName,
SecHeader->Keys->KeyName, SecHeader->Keys->Value);
-
+ if (c == ';') {
+ do {
+ c = fgetc(f);
+ } while (!(c == EOF || c == '\n'));
+ if (c == EOF)
+ goto finished;
+ }
}
}
@@ -266,6 +269,7 @@
section = New->Section;
Current = New;
}
+
/* Start search */
for (; section; section = section->link){
if (strcasecmp (section->AppName, AppName))
@@ -280,20 +284,17 @@
dprintf_profile(stddeb,"GetSetProfile // KeyName == NULL, Enumeration !\n");
for (key = section->Keys; key; key = key->link){
if (left < 1) {
- dprintf_profile(stddeb,"GetSetProfile // No more storage for enum !\n");
- return (Size - 2);
+ dprintf_profile(stddeb,"GetSetProfile // No more storage for enum !\n");
+ return Size - 2;
}
slen = MIN(strlen(key->KeyName) + 1, left);
- dprintf_profile(stddeb,"GetSetProfile // strncpy(%p, %p, %d);\n",
- ReturnedString, key->Value, slen);
- strncpy (p, key->KeyName, slen);
+ lstrcpyn(p, key->KeyName, slen);
dprintf_profile(stddeb,"GetSetProfile // enum '%s' !\n", p);
left -= slen;
p += slen;
}
- *p = '\0';
- dprintf_profile(stddeb,"GetSetProfile // normal end of enum !\n");
- return (Size - 2 - left);
+ *p = '\0';
+ return Size - 2 - left;
}
for (key = section->Keys; key; key = key->link){
int slen;
@@ -305,9 +306,8 @@
Current->changed=TRUE;
return 1;
}
- slen = MIN(strlen(key->Value), Size - 1);
- ReturnedString[slen] = 0;
- strncpy (ReturnedString, key->Value, slen);
+ slen = MIN(strlen(key->Value)+1, Size);
+ lstrcpyn(ReturnedString, key->Value, slen);
dprintf_profile(stddeb,"GetSetProfile // Return ``%s''\n", ReturnedString);
return 1;
}
@@ -317,13 +317,13 @@
if (set) {
new_key (section, KeyName, Default);
} else {
- int slen = MIN(strlen(Default), Size - 1);
- ReturnedString[slen] = 0;
- strncpy(ReturnedString, Default, slen);
+ int slen = MIN(strlen(Default)+1, Size);
+ lstrcpyn(ReturnedString, Default, slen);
dprintf_profile(stddeb,"GetSetProfile // Key not found\n");
}
return 1;
}
+
/* Non existent section */
if (set){
section = (TSecHeader *) xmalloc (sizeof (TSecHeader));
@@ -334,9 +334,8 @@
Current->Section = section;
Current->changed = TRUE;
} else {
- int slen = MIN(strlen(Default), Size - 1);
- ReturnedString[slen] = 0;
- strncpy(ReturnedString, Default, slen);
+ int slen = MIN(strlen(Default)+1, Size);
+ lstrcpyn(ReturnedString, Default, slen);
dprintf_profile(stddeb,"GetSetProfile // Section not found\n");
}
return 1;
diff --git a/misc/shell.c b/misc/shell.c
index 86d60ee..5e1911c 100644
--- a/misc/shell.c
+++ b/misc/shell.c
@@ -25,48 +25,48 @@
static char RootKeyName[]=".classes", TopKeyName[] = "[top-null]";
/*************************************************************************
- * SHELL_RegCheckForRoot() internal use only
+ * SHELL_Init()
*/
-static LONG SHELL_RegCheckForRoot()
+BOOL SHELL_Init()
{
HKEY hNewKey;
-
- if (lphRootKey == NULL){
- hNewKey = GlobalAlloc(GMEM_MOVEABLE,sizeof(KEYSTRUCT));
- lphRootKey = (LPKEYSTRUCT) GlobalLock(hNewKey);
- if (lphRootKey == NULL) {
+
+ hNewKey = GlobalAlloc(GMEM_MOVEABLE,sizeof(KEYSTRUCT));
+ lphRootKey = (LPKEYSTRUCT) GlobalLock(hNewKey);
+ if (lphRootKey == NULL) {
printf("SHELL_RegCheckForRoot: Couldn't allocate root key!\n");
- return ERROR_OUTOFMEMORY;
- }
- lphRootKey->hKey = (HKEY)1;
- lphRootKey->lpSubKey = RootKeyName;
- lphRootKey->dwType = 0;
- lphRootKey->lpValue = NULL;
- lphRootKey->lpSubLvl = lphRootKey->lpNextKey = lphRootKey->lpPrevKey = NULL;
-
- hNewKey = GlobalAlloc(GMEM_MOVEABLE,sizeof(KEYSTRUCT));
- lphTopKey = (LPKEYSTRUCT) GlobalLock(hNewKey);
- if (lphTopKey == NULL) {
- printf("SHELL_RegCheckForRoot: Couldn't allocate top key!\n");
- return ERROR_OUTOFMEMORY;
- }
- lphTopKey->hKey = 0;
- lphTopKey->lpSubKey = TopKeyName;
- lphTopKey->dwType = 0;
- lphTopKey->lpValue = NULL;
- lphTopKey->lpSubLvl = lphRootKey;
- lphTopKey->lpNextKey = lphTopKey->lpPrevKey = NULL;
-
- dprintf_reg(stddeb,"SHELL_RegCheckForRoot: Root/Top created\n");
+ return FALSE;
}
- return ERROR_SUCCESS;
+ lphRootKey->hKey = (HKEY)1;
+ lphRootKey->lpSubKey = RootKeyName;
+ lphRootKey->dwType = 0;
+ lphRootKey->lpValue = NULL;
+ lphRootKey->lpSubLvl = lphRootKey->lpNextKey = lphRootKey->lpPrevKey = NULL;
+
+ hNewKey = GlobalAlloc(GMEM_MOVEABLE,sizeof(KEYSTRUCT));
+ lphTopKey = (LPKEYSTRUCT) GlobalLock(hNewKey);
+ if (lphTopKey == NULL) {
+ printf("SHELL_RegCheckForRoot: Couldn't allocate top key!\n");
+ return FALSE;
+ }
+ lphTopKey->hKey = 0;
+ lphTopKey->lpSubKey = TopKeyName;
+ lphTopKey->dwType = 0;
+ lphTopKey->lpValue = NULL;
+ lphTopKey->lpSubLvl = lphRootKey;
+ lphTopKey->lpNextKey = lphTopKey->lpPrevKey = NULL;
+
+ dprintf_reg(stddeb,"SHELL_RegCheckForRoot: Root/Top created\n");
+
+ return TRUE;
}
/* FIXME: the loading and saving of the registry database is rather messy.
* bad input (while reading) may crash wine.
*/
void
-_DumpLevel(FILE *f,LPKEYSTRUCT lpTKey,int tabs) {
+_DumpLevel(FILE *f,LPKEYSTRUCT lpTKey,int tabs)
+{
LPKEYSTRUCT lpKey;
lpKey=lpTKey->lpSubLvl;
@@ -86,7 +86,8 @@
}
static void
-_SaveKey(HKEY hKey,char *where) {
+_SaveKey(HKEY hKey,char *where)
+{
FILE *f;
LPKEYSTRUCT lpKey;
@@ -106,7 +107,8 @@
}
void
-SHELL_SaveRegistry(void) {
+SHELL_SaveRegistry(void)
+{
/* FIXME:
* -implement win95 additional keytypes here
* (HKEY_LOCAL_MACHINE,HKEY_CURRENT_USER or whatever)
@@ -117,7 +119,8 @@
#define BUFSIZE 256
void
-_LoadLevel(FILE *f,LPKEYSTRUCT lpKey,int tabsexp,char *buf) {
+_LoadLevel(FILE *f,LPKEYSTRUCT lpKey,int tabsexp,char *buf)
+{
int i;
char *s,*t;
HKEY hNewKey;
@@ -184,7 +187,8 @@
}
void
-_LoadKey(HKEY hKey,char *from) {
+_LoadKey(HKEY hKey,char *from)
+{
FILE *f;
LPKEYSTRUCT lpKey;
char buf[BUFSIZE]; /* FIXME: long enough? */
@@ -204,12 +208,8 @@
}
void
-SHELL_LoadRegistry(void) {
- DWORD dwRet;
-
- dwRet=SHELL_RegCheckForRoot();
- if (dwRet!=ERROR_SUCCESS)
- return;/*very bad magic, if we can't even allocate the rootkeys*/
+SHELL_LoadRegistry(void)
+{
_LoadKey((HKEY)HKEY_CLASSES_ROOT,"/tmp/winereg");
}
@@ -221,10 +221,7 @@
LPKEYSTRUCT lpKey,lpNextKey;
LPCSTR ptr;
char str[128];
- LONG dwRet;
- dwRet = SHELL_RegCheckForRoot();
- if (dwRet != ERROR_SUCCESS) return dwRet;
dprintf_reg(stddeb, "RegOpenKey(%08lX, %p='%s', %p)\n",
(DWORD)hKey, lpSubKey, lpSubKey, lphKey);
if (lphKey == NULL) return ERROR_INVALID_PARAMETER;
@@ -274,12 +271,9 @@
LPKEYSTRUCT lpNewKey;
LPKEYSTRUCT lpKey;
LPKEYSTRUCT lpPrevKey;
- LONG dwRet;
LPCSTR ptr;
char str[128];
- dwRet = SHELL_RegCheckForRoot();
- if (dwRet != ERROR_SUCCESS) return dwRet;
dprintf_reg(stddeb, "RegCreateKey(%08lX, '%s', %p)\n", (DWORD)hKey, lpSubKey, lphKey);
if (lphKey == NULL) return ERROR_INVALID_PARAMETER;
switch((DWORD)hKey) {
@@ -439,11 +433,8 @@
LONG RegEnumKey(HKEY hKey, DWORD dwSubKey, LPSTR lpBuf, DWORD dwSize)
{
LPKEYSTRUCT lpKey;
- LONG dwRet;
LONG len;
- dwRet = SHELL_RegCheckForRoot();
- if (dwRet != ERROR_SUCCESS) return dwRet;
dprintf_reg(stddeb, "RegEnumKey(%08lX, %ld)\n", (DWORD)hKey, dwSubKey);
if (lpBuf == NULL) return ERROR_INVALID_PARAMETER;
switch((DWORD)hKey) {
@@ -478,11 +469,12 @@
*/
void DragAcceptFiles(HWND hWnd, BOOL b)
{
- /* flips WS_EX_ACCEPTFILES bit according to the value of b (TRUE or FALSE) */
+ /* flips WS_EX_ACCEPTFILES bit according to the value of b */
+ dprintf_reg(stddeb,"DragAcceptFiles("NPFMT", %u) old exStyle %08lx\n",
+ hWnd,b,GetWindowLong(hWnd,GWL_EXSTYLE));
- dprintf_reg(stddeb,"DragAcceptFiles("NPFMT", %u) old exStyle %08lx\n",hWnd,b,GetWindowLong(hWnd,GWL_EXSTYLE));
-
- SetWindowLong(hWnd,GWL_EXSTYLE,GetWindowLong(hWnd,GWL_EXSTYLE) | b*(LONG)WS_EX_ACCEPTFILES);
+ SetWindowLong(hWnd,GWL_EXSTYLE,
+ GetWindowLong(hWnd,GWL_EXSTYLE) | b*(LONG)WS_EX_ACCEPTFILES);
}
@@ -491,42 +483,42 @@
*/
UINT DragQueryFile(HDROP hDrop, WORD wFile, LPSTR lpszFile, WORD wLength)
{
- /* hDrop is a global memory block allocated with GMEM_SHARE
- with DROPFILESTRUCT as a header and filenames following
- it, zero length filename is in the end */
-
- LPDROPFILESTRUCT lpDropFileStruct;
- LPSTR lpCurrent;
- WORD i;
-
- dprintf_reg(stddeb,"DragQueryFile("NPFMT", %i, %p, %u)\n",
- hDrop,wFile,lpszFile,wLength);
-
- lpDropFileStruct = (LPDROPFILESTRUCT) GlobalLock(hDrop);
- if(!lpDropFileStruct)
+ /* hDrop is a global memory block allocated with GMEM_SHARE
+ * with DROPFILESTRUCT as a header and filenames following
+ * it, zero length filename is in the end */
+
+ LPDROPFILESTRUCT lpDropFileStruct;
+ LPSTR lpCurrent;
+ WORD i;
+
+ dprintf_reg(stddeb,"DragQueryFile("NPFMT", %i, %p, %u)\n",
+ hDrop,wFile,lpszFile,wLength);
+
+ lpDropFileStruct = (LPDROPFILESTRUCT) GlobalLock(hDrop);
+ if(!lpDropFileStruct)
{
- dprintf_reg(stddeb,"DragQueryFile: unable to lock handle!\n");
- return 0;
+ dprintf_reg(stddeb,"DragQueryFile: unable to lock handle!\n");
+ return 0;
}
- lpCurrent = (LPSTR) lpDropFileStruct + lpDropFileStruct->wSize;
-
- i = 0;
- while(i++ < wFile)
+ lpCurrent = (LPSTR) lpDropFileStruct + lpDropFileStruct->wSize;
+
+ i = 0;
+ while (i++ < wFile)
{
- while(*lpCurrent++); /* skip filename */
- if(!*lpCurrent)
- return (wFile == 0xFFFF)? i : 0;
+ while (*lpCurrent++); /* skip filename */
+ if (!*lpCurrent)
+ return (wFile == 0xFFFF) ? i : 0;
}
-
- i = strlen(lpCurrent);
- if(!lpszFile) return i+1; /* needed buffer size */
-
- i = ( wLength > i)? i : wLength-1;
- strncpy(lpszFile,lpCurrent,i);
- lpszFile[i]='\0';
-
- GlobalUnlock(hDrop);
- return i;
+
+ i = strlen(lpCurrent);
+ if (!lpszFile) return i+1; /* needed buffer size */
+
+ i = (wLength > i) ? i : wLength-1;
+ strncpy(lpszFile, lpCurrent, i);
+ lpszFile[i] = '\0';
+
+ GlobalUnlock(hDrop);
+ return i;
}
@@ -535,7 +527,7 @@
*/
void DragFinish(HDROP h)
{
- GlobalFree((HGLOBAL)h);
+ GlobalFree((HGLOBAL)h);
}
@@ -544,16 +536,16 @@
*/
BOOL DragQueryPoint(HDROP hDrop, POINT FAR *p)
{
- LPDROPFILESTRUCT lpDropFileStruct;
- BOOL bRet;
+ LPDROPFILESTRUCT lpDropFileStruct;
+ BOOL bRet;
- lpDropFileStruct = (LPDROPFILESTRUCT) GlobalLock(hDrop);
+ lpDropFileStruct = (LPDROPFILESTRUCT) GlobalLock(hDrop);
- memcpy(p,&lpDropFileStruct->ptMousePos,sizeof(POINT));
- bRet = lpDropFileStruct->fInNonClientArea;
+ memcpy(p,&lpDropFileStruct->ptMousePos,sizeof(POINT));
+ bRet = lpDropFileStruct->fInNonClientArea;
- GlobalUnlock(hDrop);
- return bRet;
+ GlobalUnlock(hDrop);
+ return bRet;
}
diff --git a/misc/spy.c b/misc/spy.c
index 6c9692a..e547e1c 100644
--- a/misc/spy.c
+++ b/misc/spy.c
@@ -25,7 +25,7 @@
"WM_CREATE",
"WM_DESTROY",
"WM_MOVE",
- "WM_UNUSED0",
+ "WM_SIZEWAIT",
"WM_SIZE",
"WM_ACTIVATE",
"WM_SETFOCUS",
@@ -62,7 +62,7 @@
"WM_PAINTICON",
"WM_ICONERASEBKGND",
"WM_NEXTDLGCTL",
- "WM_UNUSED4",
+ "WM_ALTTABACTIVE",
"WM_SPOOLERSTATUS",
"WM_DRAWITEM",
"WM_MEASUREITEM",
@@ -70,9 +70,19 @@
"WM_VKEYTOITEM",
"WM_CHARTOITEM",
"WM_SETFONT", /* 0x30 */
- "WM_GETFONT", NULL, NULL, NULL, NULL, NULL,
- "WM_QUERYDRAGICON", NULL,
- "WM_COMPAREITEM", NULL, NULL, NULL, NULL, NULL, NULL,
+ "WM_GETFONT",
+ "WM_SETHOTKEY",
+ "WM_GETHOTKEY",
+ "WM_FILESYSCHANGE",
+ "WM_ISACTIVEICON",
+ "WM_QUERYPARKICON",
+ "WM_QUERYDRAGICON",
+ "WM_QUERYSAVESTATE",
+ "WM_COMPAREITEM",
+ "WM_TESTING", NULL,
+ "WM_OTHERWINDOWCREATED",
+ "WM_OTHERWINDOWDESTROYED",
+ "WM_ACTIVATESHELLWINDOW", NULL,
NULL, /* 0x40 */
"WM_COMPACTING", NULL, NULL,
@@ -101,7 +111,8 @@
"WM_NCPAINT", /* 0x0085 */
"WM_NCACTIVATE", /* 0x0086 */
"WM_GETDLGCODE", /* 0x0087 */
- "WM_SYNCPAINT", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ "WM_SYNCPAINT",
+ "WM_SYNCTASK", NULL, NULL, NULL, NULL, NULL, NULL,
/* 0x0090 */
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -149,7 +160,10 @@
"WM_SYSCHAR", /* 0x0106 */
"WM_SYSDEADCHAR", /* 0x0107 */
"WM_KEYLAST", /* 0x0108 */
- NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL,
+ "WM_CONVERTREQUEST",
+ "WM_CONVERTRESULT",
+ "WM_INTERIM", NULL, NULL, NULL,
"WM_INITDIALOG", /* 0x0110 */
"WM_COMMAND", /* 0x0111 */
@@ -169,8 +183,7 @@
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/* 0x0130 */
- NULL,
- "wm_lbtrackpoint",
+ NULL, "wm_lbtrackpoint",
NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -237,7 +250,8 @@
"WM_PARENTNOTIFY", /* 0x0210 */
"WM_ENTERMENULOOP", /* 0x0211 */
"WM_EXITMENULOOP", /* 0x0212 */
- NULL, NULL, NULL, NULL, NULL,
+ "WM_NEXTMENU", /* 0x0213 */
+ NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
"WM_MDICREATE", /* 0x0220 */
@@ -344,10 +358,11 @@
/* 0x0380 */
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+
"WM_COALESCE_FIRST",
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL,
"WM_COALESCE_LAST",
- NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
diff --git a/misc/winsocket.c b/misc/winsocket.c
index 318c38e..536e5db 100644
--- a/misc/winsocket.c
+++ b/misc/winsocket.c
@@ -35,6 +35,10 @@
static FARPROC BlockFunction;
static fd_set fd_in_use;
+#ifdef __FreeBSD__
+extern int h_errno;
+#endif /* __FreeBSD__ */
+
struct ipc_packet {
long mtype;
HANDLE handle;
@@ -48,7 +52,8 @@
#endif
#define IPC_PACKET_SIZE (sizeof(struct ipc_packet) - sizeof(long))
-#define MTYPE 0xb0b0eb05
+/*#define MTYPE 0xb0b0eb05*/
+#define MTYPE 0x30b0eb05
/* These structures are Win16 only */
@@ -831,23 +836,32 @@
static void recv_message(int sig)
{
- struct ipc_packet message;
+ static struct ipc_packet message;
+ static int message_is_valid = 0;
+ BOOL result;
-/* FIXME: something about no message of desired type */
- if (msgrcv(wine_key, (struct msgbuf*)&(message),
- IPC_PACKET_SIZE, MTYPE, IPC_NOWAIT) == -1)
- perror("wine: msgrcv");
-
- fprintf(stderr,
- "WSA: PostMessage (hwnd "NPFMT", wMsg %d, wParam "NPFMT", lParam %ld)\n",
- message.hWnd,
- message.wMsg,
- message.handle,
- message.lParam);
-
- PostMessage(message.hWnd, message.wMsg, (WPARAM)message.handle, message.lParam);
-
signal(SIGUSR1, recv_message);
+ while (1) {
+
+ if (!message_is_valid) {
+ if (msgrcv(wine_key, (struct msgbuf*)&(message),
+ IPC_PACKET_SIZE, MTYPE, IPC_NOWAIT) == -1) {
+ perror("wine: msgrcv");
+ break;
+ }
+ }
+
+ result = PostMessage(message.hWnd, message.wMsg,
+ (WPARAM)message.handle, message.lParam);
+ if (result == FALSE) {
+ message_is_valid = 1;
+ break;
+ }
+ else
+ message_is_valid = 0;
+
+ }
+
}
@@ -861,13 +875,8 @@
message.wMsg = wMsg;
message.lParam = lParam;
- fprintf(stderr,
- "WSA: send (hwnd "NPFMT", wMsg %d, handle "NPFMT", lParam %ld)\n",
- hWnd, wMsg, handle, lParam);
-
-/* FIXME: something about invalid argument */
if (msgsnd(wine_key, (struct msgbuf*)&(message),
- IPC_PACKET_SIZE, IPC_NOWAIT) == -1)
+ IPC_PACKET_SIZE, 0/*IPC_NOWAIT*/) == -1)
perror("wine: msgsnd");
kill(getppid(), SIGUSR1);
@@ -1136,12 +1145,14 @@
"WINE Sockets",
#ifdef linux
"LINUX/i386",
-#endif
-#ifdef __NetBSD__
+#elif defined(__NetBSD__)
"NetBSD/i386",
-#endif
-#ifdef sunos
+#elif defined(sunos)
"SunOS",
+#elif defined(__FreeBSD__)
+ "FreeBSD",
+#else
+ "Unknown",
#endif
128,
1024,