Release 980517
Sun May 17 16:23:56 1998 Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
* [file/profile.c]
Fix the return value of PROFILE_GetSection
* [misc/crtdll.c]
Do _getdrive, fix _chdrive.
* [misc/commdlg.c]
First cut at ChooseColor[WA].
* [misc/network.c]
Do something sensible for WNetGetDirectoryType16.
Sun May 17 10:21:35 1998 Andreas Mohr <100.30936@germany.net>
* [controls/menu.c]
Fixed disabled sub menus with MF_BYPOSITION that were not disabled.
* [misc/crtdll.c] [relay32/crtdll.spec] [include/winerror.h]
Implemented fscanf, fsetpos, _access, _fpreset (thanks to Uwe Bonnes),
and _ltoa.
* [loader/task.c]
MakeProcInstance: must use CURRENT_DS if hInst == NULL.
* [misc/shell.c]
SHELL_GetResourceTable, InternalExtractIcon: fixed broken .ICO handling
* [windows/winpos.c]
DeferWindowPos: removed "same parent" requirement.
Which doc states that this is required ?
Sat May 16 20:08:11 1998 Alexandre Julliard <julliard@lrc.epfl.ch>
* [loader/module.c] [loader/ne/module.c]
More NE module cleanups.
* [loader/task.c]
Fixed SwitchStackBack().
Fri May 15 10:04:27 1998 Marcus Meissner <marcus@jet.franken.de>
* [configure.in][inlcude/acconfig.h]
Fixed broken OSS check, added check for working sigaltstack,
fixed broken statfs checks on some linux systems.
* [files/directory.c][loader/pe_image.c][relay32/builtin.c]
[loader/module.c]
Added handling of win32 module pathnames.
* [relay32/wnaspi32.spec]
New file.
* [misc/lzexpand.c]
LZCopy auto-decompresses LZ compressed files, even if they are not
specially flagged. Fixes some InstallShield problems.
* [misc/registry.c]
Some fixes for RegQueryInfoKey (reference program monkey.exe
from Win32 SDK works now better). Probably still has faults.
Fri May 15 08:58:58 1998 Martin Boehme <boehme@informatik.mu-luebeck.de>
* [graphics/mapping.c] [include/dc.h] [include/gdi.h] [objects/dc.c]
Reworked the way world transformations and mapping modes are handled
so that both of these transformations can be computed in a single
step.
* [graphics/painting.c] [graphics/path.c] [include/path.h]
More GDI path support.
* [graphics/x11drv/graphics.c]
Fixed the return value of GRAPH_DrawArc for the zero height /
zero width case to reflect Windows' behaviour.
* [include/windows.h] [relay32/gdi32.spec] [objects/dc.c]
Implemented ModifyWorldTransform and CombineTransform.
Tue May 14 18:03:46 1998 Eric Kohl <ekohl@abo.rhein-zeitung.de>
* [controls/commctrl.c][relay32/comctl32.spec]
[controls/*.c][include/*.h]
Implemented InitCommonControlsEx (dll version 4.72 compatible).
InitCommonControls calls ImageCommonControlsEx.
Registering code of the common controls had to be changed
(see XXXX_Register functions).
* [controls/status.c][include/commctrl.h][include/status.h]
Implemented most new features and fixed the look and feel.
* [contols/commctrl.c][include/commctrl.h][relay32/comctl32.spec]
Implemented MenuHelp (incomplete).
* [controls/status.c][controls/progress.c]
Changed allocation strategy for control specific memory.
* [controls/header.c][include/header.h][include/commctrl.h]
First implementation of header control.
* [windows/defwnd.c][windows/syscolors.c]
Fixed default control colors for Win95 look.
* [windows/nonclient.c]
Fixed off by one error for Win95 look. Top border of child windows
should be visible.
* [misc/imagelist.h]
Improved documentation and fixed some bugs.
Thu May 14 15:42:21 1998 Robert Wilhelm <robert@physiol.med.tu-muenchen.de>
* [relay32/crtdll.spec]
Added hypot,j0,j1,jn and ceil.
Wed May 13 19:10:10 1998 Pascal Cuoq <pcuoq@ens-lyon.fr>
* [controls/listbox.c]
Item height is now exactly font height.
Wine listboxes now behave like Windows' when they are
created without WS_VSCROLL but the program subsequently
calls ShowScrollBar or SetScrollInfo.
Wed May 13 18:33:01 1998 Ulrich Weigand <weigand@informatik.uni-erlangen.de>
* [relay32/relay386.c]
Restore ES also in the non-debug case.
* [windows/event.c]
Bugfix: Blocking TSXNextEvent could deadlock Wine.
* [win32/process.c] [windows/message.c]
Silly stubs for MsgWaitForMultipleObjects / PostThreadMessage
that make some programs run better.
* [windows/winproc.c]
WINPROC_MapMsg32Ato16/16To32A: added WM_NOTIFY.
* [win32/kernel32.c]
Added 16->32 thunking and improved 32->16 thunking functions.
* [tools/build.c]
Added new variant of CallFrom16 stub for use with Win95 thunks.
* [if1632/kernel.spec] [if1632/builtin.c] [win32/kernel32.c]
Added a few undocumented KERNEL functions.
* [loader/ne/module.c] [loader/ne/segment.c]
Call DllEntryPoint for 16-bit DLLs with subsystem >= 4.0.
* [win32/kernel32.spec] [win32/wow32.spec] [win32/ordinals.c]
Use names from the Oct 94 beta release for undoc. functions.
Wed May 13 14:18:26 1998 Matthew Becker <mbecker@glasscity.net>
* [misc/registry.c]
Code cleanup.
* [misc/cpu.c]
Commented out the registry puts temporarily.
* [programs/regtest/*]
New registry testing program.
Tue May 12 22:54:03 1998 Michael Mess <michael@kawo2.rwth-aachen.de>
* [multimedia/audio.c]
ioctl's do not commute in /dev/dsp initialization.
Tue May 12 20:11:42 1998 Karl Garrison <karlos@eznet.net>
* [win32/console.c]
Implemented SetConsoleTextAttribute, FillConsoleOutputCharacter.
Improved cursor positioning.
This allows for text colors in an xterm, rxvt, or console.
Tue May 12 17:57:52 1998 Petter Reinholdtsen <pere@td.org.uit.no>
* [Makefile.in]
Create prefix/{bin|lib} directories if missing during install.
Sun May 10 19:37:51 1998 Jan Willamowius <jan@janhh.shnet.org>
* [multimedia/mmio.c]
Have mmioSetBuffer return success (0), so Corel Draw 4
keeps working. (IO is still unbuffered)
Wed May 6 16:57:55 1998 James Juran <jrj120@psu.edu>
* [Makefile.in] [Make.rules.in]
Changed "make clean" to remove `textedit` backup files (*%)
* [controls/menu.c][graphics/x11drv/xfont.c][include/libres.h]
[loader/main.c][loader/ne/module.c][scheduler/synchro.c]
[win32/time.c][windows/winpos.c][include/windows.h]
Fixed miscellaneous compilation warnings.
* [misc/main.c][miscemu/main.c][include/main.h]
Moved prototypes to new include file main.h, various cleanups.
Tue May 5 21:05:06 1998 Morten Welinder <terra@diku.dk>
* [misc/winsock.c]
Don't refer to __FreeBSD__ when HAVE_STRERROR is meant.
* [misc/debugstr.c]
For debug_dumpstrSend, send strings to stderr.
Tue May 5 21:47:40 1998 Huw D M Davies <h.davies1@physics.oxford.ac.uk>
* [objects/region.c]
Fix for REGION_RegionOp() if newReg is one of the source regions.
Tue May 5 18:27:32 1998 Jim Peterson <jspeter@roanoke.infi.net>
* [misc/main.c]
Add '-h/-help' option and print WINE_RELEASE_INFO with usage message.
* [misc/spy.c]
Realign trace messages.
Tue May 5 15:46:47 1998 Donnie V. Savage <dsavage@cisco.com>
* [graphics/ddraw.c]
Fixed compile warnings
* [misc/winsock.c]
Warnings should not be errors.
Tue May 5 13:40:42 1998 Jim Peterson <jspeter@roanoke.infi.net>
* [*/*]
Remove many warnings through explicit casts, added #include's,
and corrected printf formats.
Tue May 5 05:18:12 1998 Insomnia (Stea Greene) <insomnia@core.binghamton.edu>
* [graphics/ddraw.c]
Kept unchanged portion of old palette when changing only a few
palette entries. Really should only deallocate the changed cells.
This make StarCraft work almost perfectly (sound overflows still
cause static).
Mon May 4 15:04:57 1998 Alexander V. Lukyanov <lav@long.yar.ru>
* [misc/lstr.c]
FormatMessage: terminate string on %0, undo linefeed strip.
diff --git a/misc/comm.c b/misc/comm.c
index 333adb9..21ca5e8 100644
--- a/misc/comm.c
+++ b/misc/comm.c
@@ -823,7 +823,7 @@
if ((act = GetCommPort(fd)) == -1) {
WARN(comm," fd %d not comm port\n",act);
return NULL;}
- stol = unknown[act];
+ stol = (unsigned char *)unknown[act];
stol += msr;
repid = ioctl(fd,TIOCMGET,&mstat);
TRACE(comm, " ioctl %d, msr %x at %p %p\n",repid,mstat,stol,unknown[act]);
diff --git a/misc/commdlg.c b/misc/commdlg.c
index d8ec825..ff5e275 100644
--- a/misc/commdlg.c
+++ b/misc/commdlg.c
@@ -1589,7 +1589,7 @@
/***********************************************************************
* ChooseColor (COMMDLG.5)
*/
-BOOL16 WINAPI ChooseColor(LPCHOOSECOLOR lpChCol)
+BOOL16 WINAPI ChooseColor16(LPCHOOSECOLOR16 lpChCol)
{
HINSTANCE16 hInst;
HANDLE16 hDlgTmpl = 0;
@@ -1662,7 +1662,7 @@
struct CCPRIVATE
{
- LPCHOOSECOLOR lpcc; /* points to public known data structure */
+ LPCHOOSECOLOR16 lpcc; /* points to public known data structure */
int nextuserdef; /* next free place in user defined color array */
HDC16 hdcMem; /* color graph used for BitBlt() */
HBITMAP16 hbmMem; /* color graph bitmap */
@@ -2342,7 +2342,7 @@
/***********************************************************************
* CC_HookCallChk [internal]
*/
-static BOOL32 CC_HookCallChk(LPCHOOSECOLOR lpcc)
+static BOOL32 CC_HookCallChk(LPCHOOSECOLOR16 lpcc)
{
if (lpcc)
if(lpcc->Flags & CC_ENABLEHOOK)
@@ -2364,8 +2364,8 @@
TRACE(commdlg,"WM_INITDIALOG lParam=%08lX\n", lParam);
lpp=calloc(1,sizeof(struct CCPRIVATE));
- lpp->lpcc=(LPCHOOSECOLOR)lParam;
- if (lpp->lpcc->lStructSize != sizeof(CHOOSECOLOR))
+ lpp->lpcc=(LPCHOOSECOLOR16)lParam;
+ if (lpp->lpcc->lStructSize != sizeof(CHOOSECOLOR16))
{
EndDialog32 (hDlg, 0) ;
return FALSE;
@@ -3642,7 +3642,7 @@
ofn16->lStructSize = sizeof(*ofn16);
ofn16->hwndOwner = ofn->hwndOwner;
/* FIXME: OPENFILENAME16 got only 16 bit for HINSTANCE... */
- ofn16->hInstance = MODULE_HANDLEtoHMODULE16(ofn->hInstance);
+ ofn16->hInstance = 0;
if (ofn->lpstrFilter) {
LPSTR s,x;
@@ -3732,7 +3732,7 @@
ofn16->lStructSize = sizeof(*ofn16);
ofn16->hwndOwner = ofn->hwndOwner;
/* FIXME: OPENFILENAME16 got only 16 bit for HINSTANCE... */
- ofn16->hInstance = MODULE_HANDLEtoHMODULE16(ofn->hInstance);
+ ofn16->hInstance = 0;
if (ofn->lpstrFilter) {
LPWSTR s;
LPSTR x,y;
@@ -3861,3 +3861,71 @@
BOOL16 (WINAPI * dofunction)(SEGPTR ofn16) = GetSaveFileName16;
return Commdlg_GetFileName32W(dofunction,ofn);
}
+
+/***********************************************************************
+ * ChooseColorA (COMDLG32.1)
+ */
+BOOL32 WINAPI ChooseColor32A(LPCHOOSECOLOR32A lpChCol )
+
+{
+ BOOL16 ret;
+ char *str = NULL;
+ COLORREF* ccref=SEGPTR_ALLOC(64);
+ LPCHOOSECOLOR16 lpcc16=SEGPTR_ALLOC(sizeof(CHOOSECOLOR16));
+
+ memset(lpcc16,'\0',sizeof(*lpcc16));
+ lpcc16->lStructSize=sizeof(*lpcc16);
+ lpcc16->hwndOwner=lpChCol->hwndOwner;
+ lpcc16->hInstance=0; /* FIXME:MODULE_HANDLEtoHMODULE16(lpChCol->hInstance)*/
+ lpcc16->rgbResult=lpChCol->rgbResult;
+ memcpy(ccref,lpChCol->lpCustColors,64);
+ lpcc16->lpCustColors=(COLORREF*)SEGPTR_GET(ccref);
+ lpcc16->Flags=lpChCol->Flags;
+ lpcc16->lCustData=lpChCol->lCustData;
+ lpcc16->lpfnHook=(WNDPROC16)lpChCol->lpfnHook;
+ if (lpChCol->lpTemplateName)
+ str = SEGPTR_STRDUP(lpChCol->lpTemplateName );
+ lpcc16->lpTemplateName=SEGPTR_GET(str);
+
+ ret = ChooseColor16(lpcc16);
+ if(str)
+ SEGPTR_FREE(str);
+ memcpy(lpChCol->lpCustColors,ccref,64);
+ SEGPTR_FREE(ccref);
+ SEGPTR_FREE(lpcc16);
+ return (BOOL32)ret;
+}
+
+/***********************************************************************
+ * ChooseColorW (COMDLG32.2)
+ */
+BOOL32 WINAPI ChooseColor32W(LPCHOOSECOLOR32W lpChCol )
+
+{
+ BOOL16 ret;
+ char *str = NULL;
+ COLORREF* ccref=SEGPTR_ALLOC(64);
+ LPCHOOSECOLOR16 lpcc16=SEGPTR_ALLOC(sizeof(CHOOSECOLOR16));
+
+ memset(lpcc16,'\0',sizeof(*lpcc16));
+ lpcc16->lStructSize=sizeof(*lpcc16);
+ lpcc16->hwndOwner=lpChCol->hwndOwner;
+ lpcc16->hInstance=0; /*FIXME:MODULE_HANDLEtoHMODULE16(lpChCol->hInstance)*/
+ lpcc16->rgbResult=lpChCol->rgbResult;
+ memcpy(ccref,lpChCol->lpCustColors,64);
+ lpcc16->lpCustColors=(COLORREF*)SEGPTR_GET(ccref);
+ lpcc16->Flags=lpChCol->Flags;
+ lpcc16->lCustData=lpChCol->lCustData;
+ lpcc16->lpfnHook=(WNDPROC16)lpChCol->lpfnHook;
+ if (lpChCol->lpTemplateName)
+ str = SEGPTR_STRDUP_WtoA(lpChCol->lpTemplateName );
+ lpcc16->lpTemplateName=SEGPTR_GET(str);
+
+ ret = ChooseColor16(lpcc16);
+ if(str)
+ SEGPTR_FREE(str);
+ memcpy(lpChCol->lpCustColors,ccref,64);
+ SEGPTR_FREE(ccref);
+ SEGPTR_FREE(lpcc16);
+ return (BOOL32)ret;
+}
diff --git a/misc/cpu.c b/misc/cpu.c
index 0369b49..390c477 100644
--- a/misc/cpu.c
+++ b/misc/cpu.c
@@ -11,7 +11,12 @@
#include "global.h"
#include "windows.h"
#include "winnt.h"
+#include "winerror.h"
#include "winreg.h"
+#include "debug.h"
+
+/* Should this write to the registry? */
+#define DO_REG FALSE
static BYTE PF[64] = {0,};
@@ -22,7 +27,7 @@
{
static int cache = 0;
static SYSTEM_INFO cachedsi;
- HKEY xhkey=0,hkey;
+ HKEY hkey;
char buf[20];
if (cache) {
@@ -52,6 +57,16 @@
/* hmm, reasonable processor feature defaults? */
+ /* The registry calls were removed because they were being called
+ before the registries were loaded, and they were giving errors */
+ /* Create this registry key for all systems */
+
+#if DO_REG
+ if (RegCreateKey16(HKEY_LOCAL_MACHINE,"HARDWARE\\DESCRIPTION\\System\\CentralProcessor",&hkey)!=ERROR_SUCCESS) {
+ WARN(reg,"Unable to register CPU information\n");
+ }
+#endif
+
#ifdef linux
{
char line[200];
@@ -59,8 +74,7 @@
if (!f)
return;
- xhkey = 0;
- RegCreateKey16(HKEY_LOCAL_MACHINE,"\\HARDWARE\\DESCRIPTION\\System\\CentralProcessor",&hkey);
+ /*xhkey = 0;*/
while (fgets(line,200,f)!=NULL) {
char *s,*value;
@@ -94,10 +108,12 @@
break;
}
}
+#if DO_REG
/* set the CPU type of the current processor */
sprintf(buf,"CPU %ld",cachedsi.dwProcessorType);
- if (xhkey)
- RegSetValueEx32A(xhkey,"Identifier",0,REG_SZ,buf,strlen(buf));
+ if (hkey)
+ RegSetValueEx32A(hkey,"Identifier",0,REG_SZ,buf,strlen(buf));
+#endif
continue;
}
/* old 2.0 method */
@@ -122,10 +138,12 @@
break;
}
}
+#if DO_REG
/* set the CPU type of the current processor */
sprintf(buf,"CPU %ld",cachedsi.dwProcessorType);
- if (xhkey)
- RegSetValueEx32A(xhkey,"Identifier",0,REG_SZ,buf,strlen(buf));
+ if (hkey)
+ RegSetValueEx32A(hkey,"Identifier",0,REG_SZ,buf,strlen(buf));
+#endif
continue;
}
if (!lstrncmpi32A(line,"fdiv_bug",strlen("fdiv_bug"))) {
@@ -148,11 +166,14 @@
if (x+1>cachedsi.dwNumberOfProcessors)
cachedsi.dwNumberOfProcessors=x+1;
+#if 0
/* create a new processor subkey */
+ /* What exactly is trying to be done here? */
sprintf(buf,"%d",x);
if (xhkey)
RegCloseKey(xhkey);
RegCreateKey16(hkey,buf,&xhkey);
+#endif
}
if (!lstrncmpi32A(line,"stepping",strlen("stepping"))) {
int x;
@@ -174,14 +195,24 @@
#else /* linux */
/* FIXME: how do we do this on other systems? */
- RegCreateKey16(hkey,"0",&xhkey);
+#if 0
RegSetValueEx32A(xhkey,"Identifier",0,REG_SZ,"CPU 386",strlen("CPU 386"));
+#endif
+
#endif /* !linux */
- if (xhkey)
+
+#if 0
+ (xhkey)
RegCloseKey(xhkey);
- RegCloseKey(hkey);
+#endif
+#if DO_REG
+ if (hkey)
+ RegCloseKey(hkey);
+#endif
+
}
+
/***********************************************************************
* IsProcessorFeaturePresent [KERNELL32.880]
*/
diff --git a/misc/crtdll.c b/misc/crtdll.c
index e9f1dd3..0acad29 100644
--- a/misc/crtdll.c
+++ b/misc/crtdll.c
@@ -20,6 +20,7 @@
/* FIXME: all the file handling is hopelessly broken -- AJ */
+#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
@@ -34,6 +35,7 @@
#include <setjmp.h>
#include "win.h"
#include "windows.h"
+#include "winerror.h"
#include "debug.h"
#include "module.h"
#include "heap.h"
@@ -305,6 +307,20 @@
}
/*********************************************************************
+ * fscanf (CRTDLL.381)
+ */
+INT32 __cdecl CRTDLL_fscanf( LPVOID stream, LPSTR format, ... )
+{
+ va_list valist;
+ INT32 res;
+
+ va_start( valist, format );
+ res = vfscanf( xlat_file_ptr(stream), format, valist );
+ va_end( valist );
+ return res;
+}
+
+/*********************************************************************
* fseek (CRTDLL.382)
*/
LONG __cdecl CRTDLL_fseek(LPVOID stream, LONG offset, INT32 whence)
@@ -323,6 +339,15 @@
}
/*********************************************************************
+ * fsetpos (CRTDLL.383)
+ */
+INT32 __cdecl CRTDLL_fsetpos(LPVOID stream, fpos_t *pos)
+{
+ TRACE(crtdll, "file %p\n", stream);
+ return fseek(xlat_file_ptr(stream), *pos, SEEK_SET);
+}
+
+/*********************************************************************
* ftell (CRTDLL.384)
*/
LONG __cdecl CRTDLL_ftell(LPVOID stream)
@@ -514,7 +539,7 @@
/*********************************************************************
- * _abnormal_termination (CRTDLL.36 )
+ * _abnormal_termination (CRTDLL.36)
*/
INT32 __cdecl CRTDLL__abnormal_termination(void)
{
@@ -524,6 +549,32 @@
/*********************************************************************
+ * _access (CRTDLL.37)
+ */
+INT32 __cdecl CRTDLL__access(LPCSTR filename, INT32 mode)
+{
+ DWORD attr = GetFileAttributes32A(filename);
+
+ if (attr == -1)
+ {
+ if (GetLastError() == ERROR_INVALID_ACCESS)
+ errno = EACCES;
+ else
+ errno = ENOENT;
+ return -1;
+ }
+
+ if ((attr & FILE_ATTRIBUTE_READONLY) && (mode & W_OK))
+ {
+ errno = EACCES;
+ return -1;
+ }
+ else
+ return 0;
+}
+
+
+/*********************************************************************
* fflush (CRTDLL.365)
*/
INT32 __cdecl CRTDLL_fflush(LPVOID stream)
@@ -1366,6 +1417,14 @@
}
/*********************************************************************
+ * _fpreset (CRTDLL.107)
+ */
+VOID __cdecl CRTDLL__fpreset(void)
+{
+ FIXME(crtdll," STUB.\n");
+}
+
+/*********************************************************************
* atexit (CRTDLL.345)
*/
INT32 __cdecl CRTDLL_atexit(LPVOID x)
@@ -1475,11 +1534,14 @@
/*********************************************************************
* _chdrive (CRTDLL.52)
+ *
+ * newdir [I] drive to change to, A=1
+ *
*/
BOOL32 __cdecl CRTDLL__chdrive(INT32 newdrive)
{
/* FIXME: generates errnos */
- return DRIVE_SetCurrentDrive(newdrive);
+ return DRIVE_SetCurrentDrive(newdrive-1);
}
/*********************************************************************
@@ -1488,7 +1550,7 @@
INT32 __cdecl CRTDLL__chdir(LPCSTR newdir)
{
if (!SetCurrentDirectory32A(newdir))
- return -1;
+ return 1;
return 0;
}
@@ -1604,6 +1666,16 @@
}
/*********************************************************************
+ * _getdrive (CRTDLL.124)
+ *
+ * Return current drive, 1 for A, 2 for B
+ */
+INT32 __cdecl CRTDLL__getdrive(VOID)
+{
+ return DRIVE_GetCurrentDrive() + 1;
+}
+
+/*********************************************************************
* _mkdir (CRTDLL.234)
*/
INT32 __cdecl CRTDLL__mkdir(LPCSTR newdir)
@@ -1701,6 +1773,25 @@
return buf;
}
+/*********************************************************************
+ * _ltoa (CRTDLL.180)
+ */
+LPSTR __cdecl CRTDLL__ltoa(long x,LPSTR buf,INT32 radix)
+{
+ switch(radix) {
+ case 2: FIXME(crtdll, "binary format not implemented !\n");
+ break;
+ case 8: wsnprintf32A(buf,0x80,"%o",x);
+ break;
+ case 10: wsnprintf32A(buf,0x80,"%d",x);
+ break;
+ case 16: wsnprintf32A(buf,0x80,"%x",x);
+ break;
+ default: FIXME(crtdll, "radix %d not implemented !\n", radix);
+ }
+ return buf;
+}
+
typedef VOID (*sig_handler_type)(VOID);
/*********************************************************************
@@ -1725,6 +1816,7 @@
TRACE(crtdll,"CRTDLL__sleep for %ld milliseconds\n",timeout);
Sleep((timeout)?timeout:1);
}
+
/*********************************************************************
* getenv (CRTDLL.437)
*/
@@ -1751,3 +1843,11 @@
FreeEnvironmentStrings32A( environ );
return pp;
}
+
+/*********************************************************************
+ * _mbsrchr (CRTDLL.223)
+ */
+LPSTR __cdecl CRTDLL__mbsrchr(LPSTR s,CHAR x) {
+ /* FIXME: handle multibyte strings */
+ return strrchr(s,x);
+}
diff --git a/misc/ddeml.c b/misc/ddeml.c
index 5d59940..4bbc1fe 100644
--- a/misc/ddeml.c
+++ b/misc/ddeml.c
@@ -121,14 +121,24 @@
/*****************************************************************
- * DdeQueryNextServer (DDEML.5)
+ * DdeQueryNextServer16 [DDEML.5]
*/
-HCONV WINAPI DdeQueryNextServer( HCONVLIST hConvList, HCONV hConvPrev )
+HCONV WINAPI DdeQueryNextServer16( HCONVLIST hConvList, HCONV hConvPrev )
{
- FIXME( ddeml, "empty stub\n" );
+ return DdeQueryNextServer32(hConvList, hConvPrev);
+}
+
+
+/*****************************************************************
+ * DdeQueryNextServer32 [USER32.112]
+ */
+HCONV WINAPI DdeQueryNextServer32( HCONVLIST hConvList, HCONV hConvPrev )
+{
+ FIXME(ddeml, "(%ld,%ld): stub\n",hConvList,hConvPrev);
return 0;
}
+
/*****************************************************************
* DdeDisconnectList (DDEML.6)
*/
@@ -273,7 +283,7 @@
*/
BOOL32 WINAPI DdeFreeStringHandle32( DWORD idInst, HSZ hsz )
{
- FIXME( ddeml, "empty stub\n" );
+ FIXME( ddeml, "(%d,%d): stub\n",idInst, hsz );
return TRUE;
}
@@ -511,5 +521,3 @@
return 0;
}
-
-
diff --git a/misc/debugstr.c b/misc/debugstr.c
index d5d8e69..7882b0f 100644
--- a/misc/debugstr.c
+++ b/misc/debugstr.c
@@ -173,7 +173,7 @@
break;
default:
if (*s<' ')
- printf ("\\0x%02x", *s);
+ fprintf (stderr, "\\0x%02x", *s);
else
fputc (*s, stderr);
}
diff --git a/misc/imagelist.c b/misc/imagelist.c
index 17f6d2c..95c27d9 100644
--- a/misc/imagelist.c
+++ b/misc/imagelist.c
@@ -4,7 +4,6 @@
* Copyright 1998 Eric Kohl
*
* TODO:
- * - Improve the documentation.
* - Improve error checking in some functions.
* - Fix ILD_TRANSPARENT error in ImageList_DrawIndirect.
* - Fix offsets in ImageList_DrawIndirect.
@@ -38,7 +37,7 @@
#define __WINE_IMAGELIST_C
/* This must be defined until "GetIconInfo" is implemented completely.
- * To do that the Cursor and Icon code in objects/cursoricon.c must
+ * To do that the cursor and icon code in objects/cursoricon.c must
* be rewritten.
*/
#define __GET_ICON_INFO_HACK__
@@ -59,31 +58,37 @@
#define MAX_OVERLAYIMAGE 15
-/*
- * internal ImageList data used for dragging
- */
+/* internal image list data used for Drag & Drop operations */
+
static HIMAGELIST himlInternalDrag = NULL;
static INT32 nInternalDragHotspotX = 0;
static INT32 nInternalDragHotspotY = 0;
-static HCURSOR32 hcurInternal = 0;
/*************************************************************************
- * IMAGELIST_InternalGrowBitmaps [Internal]
+ * IMAGELIST_InternalExpandBitmaps [Internal]
*
- * Grows the bitmaps of the given image list by the given number of
- * images. Can NOT be used to reduce the number of images.
+ * Expands the bitmaps of an image list by the given number of images.
+ *
+ * PARAMS
+ * himl [I] image list handle
+ * nImageCount [I] Number of images to add.
+ *
+ * RETURNS
+ * nothing
+ *
+ * NOTES
+ * This function can NOT be used to reduce the number of images.
*/
-static void IMAGELIST_InternalGrowBitmaps (
- HIMAGELIST himl, /* image list handle */
- INT32 nImageCount) /* number of images to grow by */
+static VOID
+IMAGELIST_InternalExpandBitmaps (HIMAGELIST himl, INT32 nImageCount)
{
HDC32 hdcImageList, hdcBitmap;
HBITMAP32 hbmNewBitmap;
INT32 nNewWidth, nNewCount;
- TRACE(imagelist, "Create grown bitmaps!\n");
+ TRACE(imagelist, "Create expanded bitmaps!\n");
nNewCount = himl->cCurImage + nImageCount + himl->cGrow;
nNewWidth = nNewCount * himl->cx;
@@ -94,7 +99,7 @@
hbmNewBitmap =
CreateBitmap32 (nNewWidth, himl->cy, 1, himl->uBitsPixel, NULL);
if (hbmNewBitmap == 0)
- ERR (imagelist, "Error creating new image bitmap!\n");
+ ERR (imagelist, "creating new image bitmap!\n");
SelectObject32 (hdcImageList, himl->hbmImage);
SelectObject32 (hdcBitmap, hbmNewBitmap);
@@ -109,7 +114,7 @@
CreateBitmap32 (nNewWidth, himl->cy, 1, 1, NULL);
if (hbmNewBitmap == 0)
- ERR (imagelist, "Error creating new mask bitmap!");
+ ERR (imagelist, "creating new mask bitmap!");
SelectObject32 (hdcImageList, himl->hbmMask);
SelectObject32 (hdcBitmap, hbmNewBitmap);
@@ -127,97 +132,92 @@
/*************************************************************************
- * ImageList_Add [COMCTL32.39]
+ * ImageList_Add [COMCTL32.39]
*
- * Add an image (and a mask) to an image list.
+ * Add an image or images to an image list.
*
- * RETURNS
- * Index of the first image that was added.
- * -1 if an error occurred.
+ * PARAMS
+ * himl [I] image list handle
+ * hbmImage [I] image bitmap handle
+ * hbmMask [I] mask bitmap handle
+ *
+ * RETURNS
+ * Success: Index of the first new image.
+ * Failure: -1
*/
-INT32 WINAPI ImageList_Add (
- HIMAGELIST himl, /* imagelist handle */
- HBITMAP32 hbmImage, /* image bitmap */
- HBITMAP32 hbmMask) /* mask bitmap */
+INT32 WINAPI
+ImageList_Add (HIMAGELIST himl, HBITMAP32 hbmImage, HBITMAP32 hbmMask)
{
- HDC32 hdcImageList, hdcImage, hdcMask;
+ HDC32 hdcSrc, hdcDst;
INT32 nFirstIndex, nImageCount;
INT32 nStartX, nRunX, nRunY;
BITMAP32 bmp;
if (himl == NULL) return (-1);
-
- hdcMask = 0; /* to keep compiler happy ;-) */
+ if (hbmImage == 0) return (-1);
GetObject32A (hbmImage, sizeof(BITMAP32), (LPVOID)&bmp);
nImageCount = bmp.bmWidth / himl->cx;
if (himl->cCurImage + nImageCount >= himl->cMaxImage)
- IMAGELIST_InternalGrowBitmaps (himl, nImageCount);
+ IMAGELIST_InternalExpandBitmaps (himl, nImageCount);
- hdcImageList = CreateCompatibleDC32 (0);
- hdcImage = CreateCompatibleDC32 (0);
+ hdcSrc = CreateCompatibleDC32 (0);
+ hdcDst = CreateCompatibleDC32 (0);
- SelectObject32 (hdcImageList, himl->hbmImage);
- SelectObject32 (hdcImage, hbmImage);
+ SelectObject32 (hdcDst, himl->hbmImage);
+ SelectObject32 (hdcSrc, hbmImage);
- BitBlt32 (hdcImageList, himl->cCurImage * himl->cx, 0,
- bmp.bmWidth, himl->cy, hdcImage, 0, 0, SRCCOPY);
+ BitBlt32 (hdcDst, himl->cCurImage * himl->cx, 0,
+ bmp.bmWidth, himl->cy, hdcSrc, 0, 0, SRCCOPY);
- if (himl->hbmMask)
- {
- if (hbmMask)
- {
- SelectObject32 (hdcImageList, himl->hbmMask);
- SelectObject32 (hdcImage, hbmMask);
- BitBlt32 (hdcImageList, himl->cCurImage * himl->cx, 0,
- bmp.bmWidth, himl->cy, hdcImage, 0, 0, SRCCOPY);
+ if (himl->hbmMask) {
+ if (hbmMask) {
+ SelectObject32 (hdcDst, himl->hbmMask);
+ SelectObject32 (hdcSrc, hbmMask);
+ BitBlt32 (hdcDst, himl->cCurImage * himl->cx, 0,
+ bmp.bmWidth, himl->cy, hdcSrc, 0, 0, SRCCOPY);
/* fix transparent areas of the image bitmap*/
- SelectObject32 (hdcMask, himl->hbmMask);
- SelectObject32 (hdcImage, himl->hbmImage);
+ SelectObject32 (hdcSrc, himl->hbmMask);
+ SelectObject32 (hdcDst, himl->hbmImage);
nStartX = himl->cCurImage * himl->cx;
- for (nRunY = 0; nRunY < himl->cy; nRunY++)
- {
- for (nRunX = 0; nRunX < bmp.bmWidth; nRunX++)
- {
- if (GetPixel32 (hdcMask, nStartX + nRunX, nRunY) ==
- RGB(255, 255, 255))
- SetPixel32 (hdcImage, nStartX + nRunX, nRunY,
+
+ for (nRunY = 0; nRunY < himl->cy; nRunY++) {
+ for (nRunX = 0; nRunX < bmp.bmWidth; nRunX++) {
+ if (GetPixel32 (hdcSrc, nStartX + nRunX, nRunY) !=
+ RGB(0, 0, 0))
+ SetPixel32 (hdcDst, nStartX + nRunX, nRunY,
RGB(0, 0, 0));
}
}
}
- else
- {
+ else {
/* create mask from the imagelist's background color */
- hdcMask = CreateCompatibleDC32 (0);
- SelectObject32 (hdcMask, himl->hbmMask);
+ SelectObject32 (hdcDst, himl->hbmMask);
+ SelectObject32 (hdcSrc, himl->hbmImage);
nStartX = himl->cCurImage * himl->cx;
- for (nRunY = 0; nRunY < himl->cy; nRunY++)
- {
- for (nRunX = 0; nRunX < bmp.bmWidth; nRunX++)
- {
- if (GetPixel32 (hdcImageList, nStartX + nRunX, nRunY) ==
+ for (nRunY = 0; nRunY < himl->cy; nRunY++) {
+ for (nRunX = 0; nRunX < bmp.bmWidth; nRunX++) {
+ if (GetPixel32 (hdcSrc, nStartX + nRunX, nRunY) ==
himl->clrBk)
{
- SetPixel32 (hdcImageList, nStartX + nRunX, nRunY,
+ SetPixel32 (hdcSrc, nStartX + nRunX, nRunY,
RGB(0, 0, 0));
- SetPixel32 (hdcMask, nStartX + nRunX, nRunY,
+ SetPixel32 (hdcDst, nStartX + nRunX, nRunY,
RGB(255, 255, 255));
}
else
- SetPixel32 (hdcMask, nStartX + nRunX, nRunY,
+ SetPixel32 (hdcDst, nStartX + nRunX, nRunY,
RGB(0, 0, 0));
}
}
- DeleteDC32 (hdcMask);
}
}
- DeleteDC32 (hdcImageList);
- DeleteDC32 (hdcImage);
+ DeleteDC32 (hdcSrc);
+ DeleteDC32 (hdcDst);
nFirstIndex = himl->cCurImage;
himl->cCurImage += nImageCount;
@@ -227,33 +227,37 @@
/*************************************************************************
- * ImageList_AddMasked [COMCTL32.41]
+ * ImageList_AddMasked [COMCTL32.41]
*
- * Adds an image to an imagelist and creates a mask from the given
- * mask color.
+ * Adds an image or images to an image list and creates a mask from the
+ * specified bitmap using the mask color.
*
- * RETURNS
- * Index of the first image that was added.
- * -1 if an error occurred.
+ * PARAMS
+ * himl [I] image list handle.
+ * hbmImage [I] image bitmap handle.
+ * clrMask [I] mask color.
+ *
+ * RETURNS
+ * Success: Index of the first new image.
+ * Failure: -1
*/
-INT32 WINAPI ImageList_AddMasked (
- HIMAGELIST himl, /* image list handle */
- HBITMAP32 hbmImage, /* bitmap handle */
- COLORREF clrMask) /* backround color of the image */
+INT32 WINAPI
+ImageList_AddMasked (HIMAGELIST himl, HBITMAP32 hbmImage, COLORREF clrMask)
{
HDC32 hdcImageList, hdcImage, hdcMask;
INT32 nIndex, nImageCount;
BITMAP32 bmp;
INT32 nStartX, nRunX, nRunY;
- if (himl == NULL) return (-1);
+ if (himl == NULL)
+ return (-1);
GetObject32A (hbmImage, sizeof(BITMAP32), &bmp);
nImageCount = bmp.bmWidth / himl->cx;
if (himl->cCurImage + nImageCount >= himl->cMaxImage)
- IMAGELIST_InternalGrowBitmaps (himl, nImageCount);
+ IMAGELIST_InternalExpandBitmaps (himl, nImageCount);
nIndex = himl->cCurImage;
himl->cCurImage += nImageCount;
@@ -266,16 +270,13 @@
BitBlt32 (hdcImageList, nIndex * himl->cx, 0, bmp.bmWidth, himl->cy,
hdcImage, 0, 0, SRCCOPY);
- if (himl->hbmMask)
- {
+ if (himl->hbmMask) {
/* create Mask */
hdcMask = CreateCompatibleDC32 (0);
SelectObject32 (hdcMask, himl->hbmMask);
nStartX = nIndex * himl->cx;
- for (nRunY = 0; nRunY < himl->cy; nRunY++)
- {
- for (nRunX = 0; nRunX < bmp.bmWidth; nRunX++)
- {
+ for (nRunY = 0; nRunY < himl->cy; nRunY++) {
+ for (nRunX = 0; nRunX < bmp.bmWidth; nRunX++) {
if (GetPixel32 (hdcImageList, nStartX + nRunX, nRunY) ==
clrMask)
{
@@ -299,33 +300,40 @@
/*************************************************************************
- * ImageList_BeginDrag [COMCTL32.42]
+ * ImageList_BeginDrag [COMCTL32.42]
*
- * Creates a temporary imagelist with an image in it, which will be used
- * as a drag image.
+ * Creates a temporary image list that contains one image. It will be used
+ * as a drag image.
*
- * RETURNS
- * ...
+ * PARAMS
+ * himlTrack [I] Handle of the source image list
+ * iTrack [I] Index of the drag image in the source image list
+ * dxHotspot [I] X position of the hot spot of the drag image
+ * dyHotspot [I] Y position of the hot spot of the drag image
+ *
+ * RETURNS
+ * Success: TRUE
+ * Failure: FALSE
*/
-BOOL32 WINAPI ImageList_BeginDrag (
- HIMAGELIST himlTrack, /* Handle of the source imagelist */
- INT32 iTrack, /* Index of the image in the source imagelist */
- INT32 dxHotspot, /* Position of the hot spot of the */
- INT32 dyHotspot) /* drag image */
+BOOL32 WINAPI
+ImageList_BeginDrag (HIMAGELIST himlTrack, INT32 iTrack,
+ INT32 dxHotspot, INT32 dyHotspot)
{
HDC32 hdcSrc, hdcDst;
- FIXME(imagelist, "ImageList_BeginDrag: partially implemented!\n");
+ FIXME(imagelist, "partially implemented!\n");
- if (himlTrack == NULL) return (FALSE);
+ if (himlTrack == NULL)
+ return (FALSE);
+
if (himlInternalDrag)
ImageList_EndDrag ();
- himlInternalDrag = ImageList_Create (himlTrack->cx, himlTrack->cy,
- himlTrack->flags, 1, 1);
- if (himlInternalDrag == NULL)
- {
+ himlInternalDrag =
+ ImageList_Create (himlTrack->cx, himlTrack->cy,
+ himlTrack->flags, 1, 1);
+ if (himlInternalDrag == NULL) {
ERR(imagelist, "Error creating drag image list!\n");
return (FALSE);
}
@@ -358,24 +366,31 @@
/*************************************************************************
- * ImageList_Copy [COMCTL32.43]
+ * ImageList_Copy [COMCTL32.43]
*
- * Copies an image of the source imagelist to an image of the
- * destination imagelist. Images can be copied or swapped.
- * Copying from one imagelist to another is allowed, in contrary to
- * M$'s original implementation. They just allow copying or swapping
- * within one imagelist (himlDst and himlSrc must be the same).
+ * Copies an image of the source image list to an image of the
+ * destination image list. Images can be copied or swapped.
*
- * RETURNS
- * ...
+ * PARAMS
+ * himlDst [I] destination image list handle.
+ * iDst [I] destination image index.
+ * himlSrc [I] source image list handle
+ * iSrc [I] source image index
+ * uFlags [I] flags for the copy operation
+ *
+ * RETURNS
+ * Success: TRUE
+ * Failure: FALSE
+ *
+ * NOTES
+ * Copying from one image list to another is possible. The original
+ * implementation just copies or swapps within one image list.
+ * Could this feature become a bug??? ;-)
*/
-BOOL32 WINAPI ImageList_Copy (
- HIMAGELIST himlDst, /* Handle of the destination imagelist */
- INT32 iDst, /* Index of the destination image */
- HIMAGELIST himlSrc, /* Handel od the source imagelist */
- INT32 iSrc, /* Index of the source image */
- INT32 uFlags) /* Flags used for the copy operation */
+BOOL32 WINAPI
+ImageList_Copy (HIMAGELIST himlDst, INT32 iDst, HIMAGELIST himlSrc,
+ INT32 iSrc, INT32 uFlags)
{
HDC32 hdcSrc, hdcDst;
@@ -391,8 +406,7 @@
else
hdcDst = CreateCompatibleDC32 (0);
- if (uFlags & ILCF_SWAP)
- {
+ if (uFlags & ILCF_SWAP) {
/* swap */
HBITMAP32 hbmTempImage, hbmTempMask;
@@ -445,8 +459,7 @@
DeleteObject32 (hbmTempMask);
DeleteObject32 (hbmTempImage);
}
- else
- {
+ else {
/* copy image */
SelectObject32 (hdcSrc, himlSrc->hbmImage);
if (himlSrc == himlDst)
@@ -477,22 +490,25 @@
/*************************************************************************
- * ImageList_Create [COMCTL32.44]
+ * ImageList_Create [COMCTL32.44]
*
- * Creates an imagelist of the given image size and number of images.
+ * Creates a new image list.
*
- * RETURNS
- * Handle of the created image list.
- * 0 if an error occurred.
+ * PARAMS
+ * cx [I] image height
+ * cy [I] image width
+ * flags [I] creation flags
+ * cInitial [I] initial number of images in the image list
+ * cGrow [I] number of images by which image list grows
+ *
+ * RETURNS
+ * Success: Handle of the created image list
+ * Failure: 0
*/
-HIMAGELIST WINAPI ImageList_Create (
- INT32 cx, /* Width of an image */
- INT32 cy, /* Height of an image */
- UINT32 flags, /* Flags for imagelist creation */
- INT32 cInitial, /* Initial number of images in the imaglist */
- INT32 cGrow) /* Number of images that is added to the */
- /* imagelist when it grows */
+HIMAGELIST WINAPI
+ImageList_Create (INT32 cx, INT32 cy, UINT32 flags,
+ INT32 cInitial, INT32 cGrow)
{
HIMAGELIST himl;
HDC32 hdc;
@@ -531,18 +547,15 @@
himl->hbmImage =
CreateBitmap32 (himl->cx * himl->cMaxImage, himl->cy,
1, himl->uBitsPixel, NULL);
- if (himl->hbmImage == 0)
- {
+ if (himl->hbmImage == 0) {
ERR(imagelist, "Error creating image bitmap!\n");
return (0);
}
- if (himl->flags & ILC_MASK)
- {
+ if (himl->flags & ILC_MASK) {
himl->hbmMask =
CreateBitmap32 (himl->cx * himl->cMaxImage, himl->cy, 1, 1, NULL);
- if (himl->hbmMask == 0)
- {
+ if (himl->hbmMask == 0) {
ERR(imagelist, "Error creating mask bitmap!\n");
if (himl->hbmImage)
DeleteObject32 (himl->hbmImage);
@@ -566,17 +579,20 @@
/*************************************************************************
- * ImageList_Destroy [COMCTL32.45]
+ * ImageList_Destroy [COMCTL32.45]
*
- * Destroy the given imagelist.
+ * Destroys an image list.
*
- * RETURNS
- * TRUE if the image list was destroyed.
- * FALSE if an error occurred.
+ * PARAMS
+ * himl [I] image list handle
+ *
+ * RETURNS
+ * Success: TRUE
+ * Failure: FALSE
*/
-BOOL32 WINAPI ImageList_Destroy (
- HIMAGELIST himl) /* Handle of the imagelist */
+BOOL32 WINAPI
+ImageList_Destroy (HIMAGELIST himl)
{
if (himl == NULL) return (FALSE);
@@ -591,68 +607,105 @@
/*************************************************************************
- * ImageList_DragEnter [COMCTL32.46]
+ * ImageList_DragEnter [COMCTL32.46]
*
- * FIXME
- * This is still an empty stub.
+ * Locks window update and displays the drag image at the given position.
+ *
+ * PARAMS
+ * hwndLock [I] handle of the window that owns the drag image.
+ * x [I] X position of the drag image.
+ * y [I] Y position of the drag image.
+ *
+ * RETURNS
+ * Success: TRUE
+ * Failure: FALSE
+ *
+ * FIXME
+ * This is still an empty stub.
+ *
+ * NOTES
+ * The position of the drag image is relative to the window, not
+ * the client area.
*/
-BOOL32 WINAPI ImageList_DragEnter (
- HWND32 hwndLock,
- INT32 x,
- INT32 y)
+BOOL32 WINAPI
+ImageList_DragEnter (HWND32 hwndLock, INT32 x, INT32 y)
{
FIXME (imagelist, "empty stub!\n");
- hcurInternal = GetCursor32 ();
-
-
- ShowCursor32 (TRUE);
-
return (FALSE);
}
/*************************************************************************
- * ImageList_DragLeave [COMCTL32.47]
+ * ImageList_DragLeave [COMCTL32.47]
+ *
+ * Unlocks window update and hides the drag image.
+ *
+ * PARAMS
+ * hwndLock [I] handle of the window that owns the drag image.
+ *
+ * RETURNS
+ * Success: TRUE
+ * Failure: FALSE
+ *
+ * FIXME
+ * This is still an empty stub.
*/
-BOOL32 WINAPI ImageList_DragLeave (
- HWND32 hwndLock)
+BOOL32 WINAPI
+ImageList_DragLeave (HWND32 hwndLock)
{
FIXME (imagelist, "empty stub!\n");
-
- SetCursor32 (hcurInternal);
- hcurInternal = 0;
-
- ShowCursor32 (FALSE);
-
return (FALSE);
}
/*************************************************************************
- * ImageList_DragMove [COMCTL32.48]
+ * ImageList_DragMove [COMCTL32.48]
+ *
+ * Moves the drag image.
+ *
+ * PARAMS
+ * x [I] X position of the drag image.
+ * y [I] Y position of the drag image.
+ *
+ * RETURNS
+ * Success: TRUE
+ * Failure: FALSE
+ *
+ * NOTES
+ * The position of the drag image is relative to the window, not
+ * the client area.
+ *
+ * FIXME
+ * This is still an empty stub.
*/
-BOOL32 WINAPI ImageList_DragMove (
- INT32 x,
- INT32 y)
+BOOL32 WINAPI
+ImageList_DragMove (INT32 x, INT32 y)
{
FIXME (imagelist, "empty stub!\n");
-// if (hcurInternal)
-// SetCursor32 (hcurInternal);
-// ImageList_Draw (himlInternalDrag, 0, x, y, 0);
-
-
return (FALSE);
}
/*************************************************************************
- * ImageList_DragShowNolock [COMCTL32.49]
+ * ImageList_DragShowNolock [COMCTL32.49]
+ *
+ * Shows or hides the drag image.
+ *
+ * PARAMS
+ * bShow [I] TRUE shows the drag image, FALSE hides it.
+ *
+ * RETURNS
+ * Success: TRUE
+ * Failure: FALSE
+ *
+ * FIXME
+ * This is still an empty stub.
*/
BOOL32 WINAPI
@@ -665,16 +718,30 @@
/*************************************************************************
- * ImageList_Draw [COMCTL32.50]
+ * ImageList_Draw [COMCTL32.50] Draws an image.
+ *
+ * PARAMS
+ * himl [I] image list handle
+ * i [I] image index
+ * hdc [I] display context handle
+ * x [I] x position
+ * y [I] y position
+ * fStyle [I] drawing flags
+ *
+ * RETURNS
+ * Success: TRUE
+ * Failure: FALSE
+ *
+ * NOTES
+ * Calls ImageList_DrawIndirect.
+ *
+ * SEE
+ * ImageList_DrawIndirect.
*/
-BOOL32 WINAPI ImageList_Draw (
- HIMAGELIST himl,
- INT32 i,
- HDC32 hdc,
- INT32 x,
- INT32 y,
- UINT32 fStyle)
+BOOL32 WINAPI
+ImageList_Draw (HIMAGELIST himl, INT32 i, HDC32 hdc,
+ INT32 x, INT32 y, UINT32 fStyle)
{
IMAGELISTDRAWPARAMS imldp;
@@ -698,20 +765,37 @@
/*************************************************************************
- * ImageList_DrawEx [COMCTL32.51]
+ * ImageList_DrawEx [COMCTL32.51]
+ *
+ * Draws an image and allows to use extended drawing features.
+ *
+ * PARAMS
+ * himl [I] image list handle
+ * i [I] image index
+ * hdc [I] device context handle
+ * x [I] X position
+ * y [I] Y position
+ * xOffs [I]
+ * yOffs [I]
+ * rgbBk [I] background color
+ * rgbFg [I] foreground color
+ * fStyle [I] drawing flags
+ *
+ * RETURNS
+ * Success: TRUE
+ * Failure: FALSE
+ *
+ * NOTES
+ * Calls ImageList_DrawIndirect.
+ *
+ * SEE
+ * ImageList_DrawIndirect.
*/
-BOOL32 WINAPI ImageList_DrawEx (
- HIMAGELIST himl,
- INT32 i,
- HDC32 hdc,
- INT32 x,
- INT32 y,
- INT32 xOffs,
- INT32 yOffs,
- COLORREF rgbBk,
- COLORREF rgbFg,
- UINT32 fStyle)
+BOOL32 WINAPI
+ImageList_DrawEx (HIMAGELIST himl, INT32 i, HDC32 hdc, INT32 x, INT32 y,
+ INT32 xOffs, INT32 yOffs, COLORREF rgbBk, COLORREF rgbFg,
+ UINT32 fStyle)
{
IMAGELISTDRAWPARAMS imldp;
@@ -735,11 +819,20 @@
/*************************************************************************
- * ImageList_DrawIndirect [COMCTL32.52]
+ * ImageList_DrawIndirect [COMCTL32.52]
+ *
+ * Draws an image using ...
+ *
+ * PARAMS
+ * pimldp [I] pointer to ...
+ *
+ * RETURNS
+ * Success:
+ * Failure:
*/
-BOOL32 WINAPI ImageList_DrawIndirect (
- IMAGELISTDRAWPARAMS *pimldp)
+BOOL32 WINAPI
+ImageList_DrawIndirect (IMAGELISTDRAWPARAMS *pimldp)
{
HIMAGELIST himlLocal;
HDC32 hdcImageList, hdcTempImage;
@@ -756,6 +849,7 @@
if (pimldp == NULL) return (FALSE);
if (pimldp->cbSize < sizeof(IMAGELISTDRAWPARAMS)) return (FALSE);
+ if (pimldp->himl == NULL) return (FALSE);
himlLocal = pimldp->himl;
@@ -912,16 +1006,18 @@
/*************************************************************************
- * ImageList_Duplicate [COMCTL32.53]
+ * ImageList_Duplicate [COMCTL32.53] Duplicates an image list.
*
- * Duplicates an image list.
+ * PARAMS
+ * himlSrc [I] source image list handle
*
- * RETURNS
- * Handle of duplicate image list, 0 if an error occurred.
+ * RETURNS
+ * Success: Handle of duplicated image list.
+ * Failure: 0
*/
-HIMAGELIST WINAPI ImageList_Duplicate (
- HIMAGELIST himlSrc)
+HIMAGELIST WINAPI
+ImageList_Duplicate (HIMAGELIST himlSrc)
{
HIMAGELIST himlDst;
HDC32 hdcSrc, hdcDst;
@@ -960,15 +1056,23 @@
/*************************************************************************
- * ImageList_EndDrag [COMCTL32.54]
+ * ImageList_EndDrag [COMCTL32.54] Finishes a drag operation.
*
- * Finishes a drag operation.
+ * Finishes a drag operation.
*
- * FIXME
- * semi-stub.
+ * PARAMS
+ * no
+ *
+ * RETURNS
+ * Success: TRUE
+ * Failure: FALSE
+ *
+ * BUGS
+ * semi-stub.
*/
-BOOL32 WINAPI ImageList_EndDrag (VOID)
+BOOL32 WINAPI
+ImageList_EndDrag (VOID)
{
FIXME (imagelist, "partially implemented!\n");
@@ -988,33 +1092,46 @@
/*************************************************************************
- * ImageList_GetBkColor [COMCTL32.55]
+ * ImageList_GetBkColor [COMCTL32.55]
*
- * Returns the background color of an image list.
+ * Returns the background color of an image list.
*
- * RETURNS
- * Background color.
+ * PARAMS
+ * himl [I] Image list handle.
+ *
+ * RETURNS
+ * Background color.
*/
-COLORREF WINAPI ImageList_GetBkColor (
- HIMAGELIST himl)
+COLORREF WINAPI
+ImageList_GetBkColor (HIMAGELIST himl)
{
+// if (himl == NULL)
+// return CLR_NONE;
+
return (himl->clrBk);
}
/*************************************************************************
- * ImageList_GetDragImage [COMCTL32.56]
+ * ImageList_GetDragImage [COMCTL32.56]
*
- * Returns the handle to the internal drag image list.
+ * Returns the handle to the internal drag image list.
*
- * FIXME
- * semi-stub.
+ * PARAMS
+ * ppt [O] Pointer to the drag position. Can be NULL.
+ * pptHotspot [O] Pointer to the position of the hot spot. Can be NULL.
+ *
+ * RETURNS
+ * Success: Handle of the drag image list.
+ * Failure: NULL.
+ *
+ * BUGS
+ * semi-stub.
*/
-HIMAGELIST WINAPI ImageList_GetDragImage (
- POINT32 *ppt,
- POINT32 *pptHotspot)
+HIMAGELIST WINAPI
+ImageList_GetDragImage (POINT32 *ppt, POINT32 *pptHotspot)
{
FIXME (imagelist, "partially imlemented!\n");
@@ -1026,13 +1143,22 @@
/*************************************************************************
- * ImageList_GetIcon [COMCTL32.57]
+ * ImageList_GetIcon [COMCTL32.57]
+ *
+ * Creates an icon from a masked image of an image list.
+ *
+ * PARAMS
+ * himl [I] image list handle
+ * i [I] image index
+ * flags [I] drawing style flags
+ *
+ * RETURNS
+ * Success: icon handle
+ * Failure: NULL
*/
-HICON32 WINAPI ImageList_GetIcon (
- HIMAGELIST himl,
- INT32 i,
- UINT32 fStyle)
+HICON32 WINAPI
+ImageList_GetIcon (HIMAGELIST himl, INT32 i, UINT32 fStyle)
{
ICONINFO ii;
HICON32 hIcon;
@@ -1071,13 +1197,25 @@
/*************************************************************************
- * ImageList_GetIconSize [COMCTL32.58]
+ * ImageList_GetIconSize [COMCTL32.58]
+ *
+ * Retrieves the size of an image in an image list.
+ *
+ * PARAMS
+ * himl [I] image list handle
+ * cx [O] pointer to the image width.
+ * cy [O] pointer to the image height.
+ *
+ * RETURNS
+ * Success: TRUE
+ * Failure: FALSE
+ *
+ * NOTES
+ * All images in an image list have the same size.
*/
-BOOL32 WINAPI ImageList_GetIconSize (
- HIMAGELIST himl,
- INT32 *cx,
- INT32 *cy)
+BOOL32 WINAPI
+ImageList_GetIconSize (HIMAGELIST himl, INT32 *cx, INT32 *cy)
{
if (himl == NULL) return (FALSE);
@@ -1092,24 +1230,45 @@
/*************************************************************************
- * ImageList_GetIconCount [COMCTL32.59]
+ * ImageList_GetIconCount [COMCTL32.59]
+ *
+ * Returns the number of images in an image list.
+ *
+ * PARAMS
+ * himl [I] image list handle.
+ *
+ * RETURNS
+ * Success: Number of images.
+ * Failure: ???? (Number of what...)
*/
-INT32 WINAPI ImageList_GetImageCount (
- HIMAGELIST himl)
+INT32 WINAPI
+ImageList_GetImageCount (HIMAGELIST himl)
{
+// if (himl == NULL)
+// return -1;
+
return (himl->cCurImage);
}
/*************************************************************************
- * ImageList_GetImageInfo [COMCTL32.60]
+ * ImageList_GetImageInfo [COMCTL32.60]
+ *
+ * Returns information about an image in an image list.
+ *
+ * PARAMS
+ * himl [I] image list handle.
+ * i [I] image index
+ * pImageInfo [O] pointer to the image information.
+ *
+ * RETURNS
+ * Success: TRUE
+ * Failure: FALSE
*/
-BOOL32 WINAPI ImageList_GetImageInfo (
- HIMAGELIST himl,
- INT32 i,
- IMAGEINFO *pImageInfo)
+BOOL32 WINAPI
+ImageList_GetImageInfo (HIMAGELIST himl, INT32 i, IMAGEINFO *pImageInfo)
{
if ((himl == NULL) || (pImageInfo == NULL)) return (FALSE);
@@ -1126,16 +1285,28 @@
/*************************************************************************
- * ImageList_GetImageRect [COMCTL32.61]
+ * ImageList_GetImageRect [COMCTL32.61]
*
- * COMMENTS
+ * Retrieves the rectangle of the specified image in an image list.
+ *
+ * PARAMS
+ * himl [I] image list handle
+ * i [I] image index
+ * lpRect [O] pointer to the image rectangle
+ *
+ * RETURNS
+ * Success: TRUE ????
+ * Failure: FALSE ????
+ *
+ * NOTES
+ * This is an UNDOCUMENTED function!!!
+ *
+ * BUGS
* I don't know if it really returns a BOOL32 or something else!!!??
*/
-BOOL32 WINAPI ImageList_GetImageRect (
- HIMAGELIST himl,
- INT32 i,
- LPRECT32 lpRect)
+BOOL32 WINAPI
+ImageList_GetImageRect (HIMAGELIST himl, INT32 i, LPRECT32 lpRect)
{
if (himl == NULL) return (FALSE);
if ((i < 0) || (i >= himl->cCurImage)) return (FALSE);
@@ -1151,17 +1322,28 @@
/*************************************************************************
- * ImageList_LoadImage32A [COMCTL32.63]
+ * ImageList_LoadImage32A [COMCTL32.63]
+ *
+ * Creates an image list from a bitmap, icon or cursor.
+ *
+ * PARAMS
+ * hi [I]
+ * lpbmp [I]
+ * cx [I]
+ * cy [I]
+ * cGrow [I]
+ * clrMask [I]
+ * uType [I]
+ * uFlags [I]
+ *
+ * RETURNS
+ * Success:
+ * Failure:
*/
-HIMAGELIST WINAPI ImageList_LoadImage32A (
- HINSTANCE32 hi,
- LPCSTR lpbmp,
- INT32 cx,
- INT32 cGrow,
- COLORREF clrMask,
- UINT32 uType,
- UINT32 uFlags)
+HIMAGELIST WINAPI
+ImageList_LoadImage32A (HINSTANCE32 hi, LPCSTR lpbmp, INT32 cx, INT32 cGrow,
+ COLORREF clrMask, UINT32 uType, UINT32 uFlags)
{
HIMAGELIST himl = NULL;
HANDLE32 handle;
@@ -1217,17 +1399,28 @@
/*************************************************************************
- * ImageList_LoadImage32W [COMCTL32.64]
+ * ImageList_LoadImage32W [COMCTL32.64]
+ *
+ * Creates an image list from a bitmap, icon or cursor.
+ *
+ * PARAMS
+ * hi [I]
+ * lpbmp [I]
+ * cx [I]
+ * cy [I]
+ * cGrow [I]
+ * clrMask [I]
+ * uType [I]
+ * uFlags [I]
+ *
+ * RETURNS
+ * Success:
+ * Failure:
*/
-HIMAGELIST WINAPI ImageList_LoadImage32W (
- HINSTANCE32 hi,
- LPCWSTR lpbmp,
- INT32 cx,
- INT32 cGrow,
- COLORREF clrMask,
- UINT32 uType,
- UINT32 uFlags)
+HIMAGELIST WINAPI
+ImageList_LoadImage32W (HINSTANCE32 hi, LPCWSTR lpbmp, INT32 cx, INT32 cGrow,
+ COLORREF clrMask, UINT32 uType, UINT32 uFlags)
{
HIMAGELIST himl = NULL;
HANDLE32 handle;
@@ -1286,16 +1479,27 @@
/*************************************************************************
- * ImageList_Merge [COMCTL32.65]
+ * ImageList_Merge [COMCTL32.65]
+ *
+ * Creates a new image list that contains a merged image from the specified
+ * images of both source image lists.
+ *
+ * PARAMS
+ * himl1 [I] first image list handle
+ * i1 [I] first image index
+ * himl2 [I] second image list handle
+ * i2 [I] second image index
+ * dx [I] X offset of the second image relative to the first.
+ * dy [I] Y offset of the second image relative to the first.
+ *
+ * RETURNS
+ * Success:
+ * Failure:
*/
-HIMAGELIST WINAPI ImageList_Merge (
- HIMAGELIST himl1,
- INT32 i1,
- HIMAGELIST himl2,
- INT32 i2,
- INT32 xOffs,
- INT32 yOffs)
+HIMAGELIST WINAPI
+ImageList_Merge (HIMAGELIST himl1, INT32 i1, HIMAGELIST himl2, INT32 i2,
+ INT32 dx, INT32 dy)
{
HIMAGELIST himlDst = NULL;
HDC32 hdcSrcImage, hdcDstImage;
@@ -1316,34 +1520,34 @@
return (NULL);
}
- if (xOffs > 0) {
- cxDst = _MAX (himl1->cx, xOffs + himl2->cx);
+ if (dx > 0) {
+ cxDst = _MAX (himl1->cx, dx + himl2->cx);
xOff1 = 0;
- xOff2 = xOffs;
+ xOff2 = dx;
}
- else if (xOffs < 0) {
- cxDst = _MAX (himl2->cx, himl1->cx - xOffs);
- xOff1 = -xOffs;
+ else if (dx < 0) {
+ cxDst = _MAX (himl2->cx, himl1->cx - dx);
+ xOff1 = -dx;
xOff2 = 0;
}
else {
- cxDst = 0;
+ cxDst = _MAX (himl1->cx, himl2->cx);
xOff1 = 0;
xOff2 = 0;
}
- if (yOffs > 0) {
- cyDst = _MAX (himl1->cy, yOffs + himl2->cy);
+ if (dy > 0) {
+ cyDst = _MAX (himl1->cy, dy + himl2->cy);
yOff1 = 0;
- yOff2 = yOffs;
+ yOff2 = dy;
}
- else if (yOffs < 0) {
- cyDst = _MAX (himl2->cy, himl1->cy - yOffs);
- yOff1 = -yOffs;
+ else if (dy < 0) {
+ cyDst = _MAX (himl2->cy, himl1->cy - dy);
+ yOff1 = -dy;
yOff2 = 0;
}
else {
- cyDst = 0;
+ cyDst = _MAX (himl1->cy, himl2->cy);
yOff1 = 0;
yOff2 = 0;
}
@@ -1392,10 +1596,22 @@
}
+/*************************************************************************
+ * ImageList_Read [COMCTL32.66]
+ *
+ * Reads an image list from a stream.
+ *
+ * PARAMS
+ * pstm [I] pointer to a stream
+ *
+ * RETURNS
+ * Success: image list handle
+ * Failure: NULL
+ */
+
#if 0
#if __IStream_INTERFACE_DEFINED__
-HIMAGELIST WINAPI ImageList_Read (
- LPSTREAM pstm)
+HIMAGELIST WINAPI ImageList_Read (LPSTREAM pstm)
{
FIXME (imagelist, "empty stub!\n");
@@ -1406,9 +1622,20 @@
#endif /* 0 */
-BOOL32 WINAPI ImageList_Remove (
- HIMAGELIST himl,
- INT32 i)
+/*************************************************************************
+ * ImageList_Remove [COMCTL32.67] Removes an image from an image list
+ *
+ * PARAMS
+ * himl [I] image list handle
+ * i [I] image index
+ *
+ * RETURNS
+ * Success: TRUE
+ * Failure: FALSE
+ */
+
+BOOL32 WINAPI
+ImageList_Remove (HIMAGELIST himl, INT32 i)
{
HBITMAP32 hbmNewImage, hbmNewMask;
HDC32 hdcSrc, hdcDst;
@@ -1521,11 +1748,25 @@
}
-BOOL32 WINAPI ImageList_Replace (
- HIMAGELIST himl,
- INT32 i,
- HBITMAP32 hbmImage,
- HBITMAP32 hbmMask)
+/*************************************************************************
+ * ImageList_Replace [COMCTL32.68]
+ *
+ * Replaces an image in an image list with a new image.
+ *
+ * PARAMS
+ * himl [I] image list handle
+ * i [I] image index
+ * hbmImage [I] image bitmap handle
+ * hbmMask [I] mask bitmap handle. Can be NULL.
+ *
+ * RETURNS
+ * Success: TRUE
+ * Failure: FALSE
+ */
+
+BOOL32 WINAPI
+ImageList_Replace (HIMAGELIST himl, INT32 i, HBITMAP32 hbmImage,
+ HBITMAP32 hbmMask)
{
HDC32 hdcImageList, hdcImage;
BITMAP32 bmp;
@@ -1568,10 +1809,23 @@
}
-INT32 WINAPI ImageList_ReplaceIcon (
- HIMAGELIST himl,
- INT32 i,
- HICON32 hIcon)
+/*************************************************************************
+ * ImageList_ReplaceIcon [COMCTL32.69]
+ *
+ * Replaces an image in an image list using an icon.
+ *
+ * PARAMS
+ * himl [I] image list handle
+ * i [I] image index
+ * hIcon [I] icon handle
+ *
+ * RETURNS
+ * Success: index of the replaced image
+ * Failure: -1
+ */
+
+INT32 WINAPI
+ImageList_ReplaceIcon (HIMAGELIST himl, INT32 i, HICON32 hIcon)
{
HDC32 hdcImageList, hdcImage;
INT32 nIndex;
@@ -1602,7 +1856,7 @@
if (i == -1) {
if (himl->cCurImage + 1 >= himl->cMaxImage)
- IMAGELIST_InternalGrowBitmaps (himl, 1);
+ IMAGELIST_InternalExpandBitmaps (himl, 1);
nIndex = himl->cCurImage;
himl->cCurImage++;
@@ -1648,35 +1902,101 @@
}
-COLORREF WINAPI ImageList_SetBkColor (
- HIMAGELIST himl,
- COLORREF clrBk)
+/*************************************************************************
+ * ImageList_SetBkColor [COMCTL32.70]
+ *
+ * Sets the background color of an image list.
+ *
+ * PARAMS
+ * himl [I] image list handle
+ * clrBk [I] background color
+ *
+ * RETURNS
+ * Success: previous background color
+ * Failure: CLR_NONE
+ */
+
+COLORREF WINAPI
+ImageList_SetBkColor (HIMAGELIST himl, COLORREF clrBk)
{
COLORREF clrOldBk;
+ if (himl == NULL)
+ return (CLR_NONE);
+
clrOldBk = himl->clrBk;
himl->clrBk = clrBk;
return (clrOldBk);
}
-BOOL32 WINAPI ImageList_SetDragCursorImage (
- HIMAGELIST himlDrag,
- INT32 iDrag,
- INT32 dxHotspot,
- INT32 dyHotspot)
+/*************************************************************************
+ * ImageList_SetDragCursorImage [COMCTL32.75]
+ *
+ * Combines the specified image with the current drag image
+ *
+ * PARAMS
+ * himlDrag [I] drag image list handle
+ * iDrag [I] drag image index
+ * dxHotspot [I] X position of the hot spot
+ * dyHotspot [I] Y position of the hot spot
+ *
+ * RETURNS
+ * Success: TRUE
+ * Failure: FALSE
+ *
+ * BUGS
+ * empty stub.
+ */
+
+BOOL32 WINAPI
+ImageList_SetDragCursorImage (HIMAGELIST himlDrag, INT32 iDrag,
+ INT32 dxHotspot, INT32 dyHotspot)
{
+ HIMAGELIST himlTemp;
+
FIXME (imagelist, "empty stub!\n");
+ if (himlInternalDrag == NULL) return (FALSE);
+
+ TRACE (imagelist, " dxH=%d dyH=%d nX=%d nY=%d\n",
+ dxHotspot, dyHotspot, nInternalDragHotspotX, nInternalDragHotspotY);
+
+ himlTemp = ImageList_Merge (himlInternalDrag, 0, himlDrag, iDrag,
+ dxHotspot, dyHotspot);
+
+ ImageList_Destroy (himlInternalDrag);
+ himlInternalDrag = himlTemp;
+
+ nInternalDragHotspotX = dxHotspot;
+ nInternalDragHotspotY = dyHotspot;
+
return (FALSE);
}
+/*************************************************************************
+ * ImageList_SetFilter [COMCTL32.76]
+ *
+ * Sets a filter (or does something completely different)!!???
+ *
+ * PARAMS
+ * himl [I] ???
+ * i [I] ???
+ * dwFilter [I] ???
+ *
+ * RETURNS
+ * Success: TRUE
+ * Failure: FALSE
+ *
+ * BUGS
+ * undocumented!!!!
+ * empty stub.
+ */
+
#if 0
-BOOL32 WINAPI ImageList_SetFilter (
- HIMAGELIST himl,
- INT32 iIndex,
- INT32 iFilter)
+BOOL32 WINAPI
+ImageList_SetFilter (HIMAGELIST himl, INT32 i, DWORD dwFilter)
{
FIXME (imagelist, "empty stub!\n");
@@ -1685,10 +2005,23 @@
#endif /* 0 */
-BOOL32 WINAPI ImageList_SetIconSize (
- HIMAGELIST himl,
- INT32 cx,
- INT32 cy)
+/*************************************************************************
+ * ImageList_SetIconSize [COMCTL32.77]
+ *
+ * Sets the image size of the bitmap and deletes all images.
+ *
+ * PARAMS
+ * himl [I] image list handle
+ * cx [I] image width
+ * cy [I] image height
+ *
+ * RETURNS
+ * Success: TRUE
+ * Failure: FALSE
+ */
+
+BOOL32 WINAPI
+ImageList_SetIconSize (HIMAGELIST himl, INT32 cx, INT32 cy)
{
INT32 nCount;
@@ -1718,9 +2051,22 @@
}
-BOOL32 WINAPI ImageList_SetImageCount (
- HIMAGELIST himl,
- INT32 iImageCount)
+/*************************************************************************
+ * ImageList_SetImageCount [COMCTL32.78]
+ *
+ * Resizes an image list to the specified number of images.
+ *
+ * PARAMS
+ * himl [I] image list handle
+ * iImageCount [I] number of images in the image list
+ *
+ * RETURNS
+ * Success: TRUE
+ * Failure: FALSE
+ */
+
+BOOL32 WINAPI
+ImageList_SetImageCount (HIMAGELIST himl, INT32 iImageCount)
{
HDC32 hdcImageList, hdcBitmap;
HBITMAP32 hbmNewBitmap;
@@ -1783,10 +2129,23 @@
}
-BOOL32 WINAPI ImageList_SetOverlayImage (
- HIMAGELIST himl,
- INT32 iImage,
- INT32 iOverlay)
+/*************************************************************************
+ * ImageList_SetOverlayImage [COMCTL32.79]
+ *
+ * Assigns an overlay mask index to an existing image in an image list.
+ *
+ * PARAMS
+ * himl [I] image list handle
+ * iImage [I] image index
+ * iOverlay [I] overlay mask index
+ *
+ * RETURNS
+ * Success: TRUE
+ * Failure: FALSE
+ */
+
+BOOL32 WINAPI
+ImageList_SetOverlayImage (HIMAGELIST himl, INT32 iImage, INT32 iOverlay)
{
if ((iOverlay < 1) || (iOverlay > MAX_OVERLAYIMAGE)) return (FALSE);
if ((iImage < 0) || (iImage > himl->cCurImage)) return (FALSE);
@@ -1796,11 +2155,27 @@
}
+/*************************************************************************
+ * ImageList_Write [COMCTL32.80]
+ *
+ * Writes an image list to a stream.
+ *
+ * PARAMS
+ * himl [I] Image list handle.
+ * pstm [O] Pointer to a stream.
+ *
+ * RETURNS
+ * Success: TRUE
+ * Failure: FALSE
+ *
+ * BUGS
+ * empty stub.
+ */
+
#if 0
#if __IStream_INTERFACE_DEFINED__
-BOOL32 WINAPI ImageList_Write (
- HIMAGELIST himl,
- LPSTREAM pstm)
+BOOL32 WINAPI
+ImageList_Write (HIMAGELIST himl, LPSTREAM pstm)
{
FIXME (imagelist, "empty stub!\n");
@@ -1809,3 +2184,4 @@
}
#endif /* __IStream_INTERFACE_DEFINED__ */
#endif /* 0 */
+
diff --git a/misc/lstr.c b/misc/lstr.c
index 98d8748..1491d4f 100644
--- a/misc/lstr.c
+++ b/misc/lstr.c
@@ -152,15 +152,15 @@
*/
void WINAPI OutputDebugString16( LPCSTR str )
{
- char *module;
+ char module[10];
char *p, *buffer = HeapAlloc( GetProcessHeap(), 0, strlen(str)+2 );
/* Remove CRs */
for (p = buffer; *str; str++) if (*str != '\r') *p++ = *str;
*p = '\0';
if ((p > buffer) && (p[-1] == '\n')) p[1] = '\0'; /* Remove trailing \n */
- module = MODULE_GetModuleName( GetCurrentTask() );
- TRACE(resource, "%s says '%s'\n",
- module ? module : "???", buffer );
+ if (!GetModuleName( GetCurrentTask(), module, sizeof(module) ))
+ strcpy( module, "???" );
+ TRACE(resource, "%s says '%s'\n", module, buffer );
HeapFree( GetProcessHeap(), 0, buffer );
}
@@ -553,7 +553,7 @@
if (from) {
f=from;
- while (*f) {
+ while (*f && !nolinefeed) {
if (*f=='%') {
int insertnr;
char *fmtstr,*sprintfbuf,*x,*lastf;
@@ -646,14 +646,7 @@
}
*t='\0';
}
- if (nolinefeed) {
- /* remove linefeed */
- if(t>target && t[-1]=='\n') {
- *--t=0;
- if(t>target && t[-1]=='\r')
- *--t=0;
- }
- } else {
+ if (!nolinefeed) {
/* add linefeed */
if(t==target || t[-1]!='\n')
ADD_TO_T('\n'); /* FIXME: perhaps add \r too? */
@@ -732,7 +725,7 @@
if (from) {
f=from;
- while (*f) {
+ while (*f && !nolinefeed) {
if (*f=='%') {
int insertnr;
char *fmtstr,*sprintfbuf,*x;
@@ -826,14 +819,7 @@
}
*t='\0';
}
- if (nolinefeed) {
- /* remove linefeed */
- if(t>target && t[-1]=='\n') {
- *--t=0;
- if(t>target && t[-1]=='\r')
- *--t=0;
- }
- } else {
+ if (!nolinefeed) {
/* add linefeed */
if(t==target || t[-1]!='\n')
ADD_TO_T('\n'); /* FIXME: perhaps add \r too? */
diff --git a/misc/lzexpand.c b/misc/lzexpand.c
index dcf6675..6bc9f44 100644
--- a/misc/lzexpand.c
+++ b/misc/lzexpand.c
@@ -473,17 +473,25 @@
*/
LONG WINAPI LZCopy32( HFILE32 src, HFILE32 dest )
{
- int i,ret,wret;
+ int usedlzinit=0,i,ret,wret;
LONG len;
+ HFILE32 oldsrc = src;
#define BUFLEN 1000
BYTE buf[BUFLEN];
INT32 WINAPI (*xread)(HFILE32,LPVOID,UINT32);
TRACE(file,"(%d,%d)\n",src,dest);
+ if (src<0x400) {
+ src = LZInit32(src);
+ if (src!=oldsrc)
+ usedlzinit=1;
+ if (src>0xfff0)
+ return 0;
+ }
+
for (i=0;i<nroflzstates;i++)
if (src==lzstates[i].lzfd)
break;
-
/* not compressed? just copy */
if (i==nroflzstates)
xread=(INT32(*)(HFILE32,LPVOID,UINT32))_lread32;
@@ -504,6 +512,8 @@
if (wret!=ret)
return LZERROR_WRITE;
}
+ if (usedlzinit)
+ LZClose32(src);
return len;
#undef BUFLEN
}
diff --git a/misc/main.c b/misc/main.c
index eea58b9..6d7f47d 100644
--- a/misc/main.c
+++ b/misc/main.c
@@ -116,6 +116,7 @@
#define NB_OPTIONS (sizeof(optionsTable) / sizeof(optionsTable[0]))
#define USAGE \
+ "%s\n" \
"Usage: %s [options] \"program_name [arguments]\"\n" \
"\n" \
"Options:\n" \
@@ -128,6 +129,7 @@
" -dll name Enable or disable built-in DLLs\n" \
" -failreadonly Read only files may not be opened in write mode\n" \
" -fixedmap Use a \"standard\" color map\n" \
+ " -help Show this help message\n" \
" -iconic Start as an icon\n" \
" -language xx Set the language (one of En,Es,De,No,Fr,Fi,Da,Cz,Eo,It,Ko,\n Hu,Pl,Po,Sw,Ca)\n" \
" -managed Allow the window manager to manage created windows\n" \
@@ -146,7 +148,7 @@
*/
void MAIN_Usage( char *name )
{
- MSG( USAGE, name );
+ MSG( USAGE, WINE_RELEASE_INFO, name );
exit(1);
}
@@ -199,12 +201,14 @@
/***********************************************************************
- * ParseDebugOptions
+ * MAIN_ParseDebugOptions
*
* Turns specific debug messages on or off, according to "options".
- * Returns TRUE if parsing was successful
+ *
+ * RETURNS
+ * TRUE if parsing was successful
*/
-BOOL32 ParseDebugOptions(char *options)
+static BOOL32 MAIN_ParseDebugOptions(char *options)
{
int l, cls;
if (strlen(options)<3)
@@ -330,6 +334,11 @@
MSG( "%s\n", WINE_RELEASE_INFO );
exit(0);
}
+ if (!strcmp( argv[i], "-h" ) || !strcmp( argv[i], "-help" ))
+ {
+ MAIN_Usage(argv[0]);
+ exit(0);
+ }
}
/* Open display */
@@ -383,7 +392,7 @@
if (MAIN_GetResource( db, ".mode", &value))
MAIN_ParseModeOption( (char *)value.addr );
if (MAIN_GetResource( db, ".debugoptions", &value))
- ParseDebugOptions((char*)value.addr);
+ MAIN_ParseDebugOptions((char*)value.addr);
if (MAIN_GetResource( db, ".debugmsg", &value))
{
#ifndef DEBUG_RUNTIME
@@ -392,7 +401,7 @@
argv[0]);
exit(1);
#else
- if (ParseDebugOptions((char*)value.addr)==FALSE)
+ if (MAIN_ParseDebugOptions((char*)value.addr)==FALSE)
{
int i;
MSG("%s: Syntax: -debugmsg [class]+xxx,... or "
@@ -531,6 +540,9 @@
}
+/***********************************************************************
+ * called_at_exit
+ */
static void called_at_exit(void)
{
MAIN_RestoreSetup();
diff --git a/misc/network.c b/misc/network.c
index 1df5a1c..2c17dcb 100644
--- a/misc/network.c
+++ b/misc/network.c
@@ -478,9 +478,14 @@
*/
int WINAPI WNetGetDirectoryType16(LPSTR lpName, LPINT16 lpType)
{
- FIXME(wnet, "('%s',%p): stub\n",lpName,lpType);
- *lpType = 0;
- return WN_NO_NETWORK;
+ UINT32 type = GetDriveType32A(lpName);
+
+ if (type == DRIVE_DOESNOTEXIST)
+ type = GetDriveType32A(NULL);
+ *lpType = (type==DRIVE_REMOTE)?WNDT_NETWORK:WNDT_NORMAL;
+ TRACE(wnet,"%s is %s\n",lpName,(*lpType==WNDT_NETWORK)?
+ "WNDT_NETWORK":"WNDT_NORMAL");
+ return WN_SUCCESS;
}
/*****************************************************************
diff --git a/misc/registry.c b/misc/registry.c
index 537c4ed..d4569e6 100644
--- a/misc/registry.c
+++ b/misc/registry.c
@@ -6,6 +6,17 @@
* December 21, 1997 - Kevin Cozens
* Fixed bugs in the _w95_loadreg() function. Added extra information
* regarding the format of the Windows '95 registry files.
+ *
+ * May 5, 1998 - Matthew Becker
+ * Changed optionflags to DWORD instead of int because it could be 0x8000000
+ * All error return values must come from winerror.h
+ *
+ * NOTES
+ * When changing this file, please re-run the regtest program to ensure
+ * the conditions are handled properly.
+ *
+ * TODO
+ * Security access
*/
#include <stdlib.h>
@@ -29,6 +40,9 @@
#include "xmalloc.h"
#include "winreg.h"
+void SHELL_StartupRegistry();
+
+/* This is not used anywhere */
#define DEBUG_W95_LOADREG 0
/* FIXME: following defines should be configured global ... */
@@ -83,8 +97,12 @@
/* what valuetypes do we need to convert? */
#define UNICONVMASK ((1<<REG_SZ)|(1<<REG_MULTI_SZ)|(1<<REG_EXPAND_SZ))
-extern LPWSTR __cdecl CRTDLL_wcschr(LPWSTR a,WCHAR c);
+/*
+ * FIXME
+ * Are these doing the same as HEAP_strdupAtoW and HEAP_strdupWtoA?
+ * If so, can we remove them?
+ */
static LPWSTR strdupA2W(LPCSTR src)
{
LPWSTR dest=xmalloc(2*strlen(src)+2);
@@ -111,61 +129,97 @@
static int nrofopenhandles=0;
static int currenthandle=1;
-static void
-add_handle(HKEY hkey,LPKEYSTRUCT lpkey,REGSAM accessmask) {
- int i;
- for (i=0;i<nrofopenhandles;i++) {
- if (openhandles[i].lpkey==lpkey) {
- WARN(reg, "Tried to add %p twice!\n",lpkey);
- }
- if (openhandles[i].hkey==hkey) {
- WARN(reg, "Tried to add %lx twice!\n",(LONG)hkey);
- }
- }
- openhandles=xrealloc( openhandles,
- sizeof(struct openhandle)*(nrofopenhandles+1)
- );
- openhandles[i].lpkey = lpkey;
- openhandles[i].hkey = hkey;
- openhandles[i].accessmask= accessmask;
- nrofopenhandles++;
+/******************************************************************************
+ * add_handle [Internal]
+ */
+static void add_handle( HKEY hkey, LPKEYSTRUCT lpkey, REGSAM accessmask )
+{
+ int i;
+
+ TRACE(reg,"(%x,%p,%lx)\n",hkey,lpkey,accessmask);
+ if (lpkey)
+ TRACE(reg," (%s)\n",debugstr_w(lpkey->keyname));
+
+ /* Check for duplicates */
+ for (i=0;i<nrofopenhandles;i++) {
+ if (openhandles[i].lpkey==lpkey) {
+ /* This is not really an error - the user is allowed to create
+ two (or more) handles to the same key */
+ /*WARN(reg, "Adding key %p twice\n",lpkey);*/
+ }
+ if (openhandles[i].hkey==hkey) {
+ WARN(reg, "Adding handle %x twice\n",hkey);
+ }
+ }
+ openhandles=xrealloc( openhandles,
+ sizeof(struct openhandle)*(nrofopenhandles+1));
+
+ openhandles[i].lpkey = lpkey;
+ openhandles[i].hkey = hkey;
+ openhandles[i].accessmask = accessmask;
+ nrofopenhandles++;
}
-static LPKEYSTRUCT
-get_handle(HKEY hkey) {
- int i;
- for (i=0;i<nrofopenhandles;i++)
- if (openhandles[i].hkey==hkey)
- return openhandles[i].lpkey;
- WARN(reg, "Didn't find handle %lx?\n",(LONG)hkey);
- return NULL;
+/******************************************************************************
+ * get_handle [Internal]
+ *
+ * RETURNS
+ * Success: Pointer to key
+ * Failure: NULL
+ */
+static LPKEYSTRUCT get_handle( HKEY hkey )
+{
+ int i;
+
+ for (i=0; i<nrofopenhandles; i++)
+ if (openhandles[i].hkey == hkey)
+ return openhandles[i].lpkey;
+ WARN(reg, "Could not find handle %x\n",hkey);
+ return NULL;
}
-static void
-remove_handle(HKEY hkey) {
- int i;
- for (i=0;i<nrofopenhandles;i++)
- if (openhandles[i].hkey==hkey)
- break;
- if (i==nrofopenhandles) {
- WARN(reg, "Didn't find handle %08x?\n",hkey);
- return;
- }
- memcpy( openhandles+i,
- openhandles+i+1,
- sizeof(struct openhandle)*(nrofopenhandles-i-1)
- );
- openhandles=xrealloc(openhandles,sizeof(struct openhandle)*(nrofopenhandles-1));
- nrofopenhandles--;
- return;
+/******************************************************************************
+ * remove_handle [Internal]
+ *
+ * PARAMS
+ * hkey [I] Handle of key to remove
+ *
+ * RETURNS
+ * Success: ERROR_SUCCESS
+ * Failure: ERROR_INVALID_HANDLE
+ */
+static DWORD remove_handle( HKEY hkey )
+{
+ int i;
+
+ for (i=0;i<nrofopenhandles;i++)
+ if (openhandles[i].hkey==hkey)
+ break;
+
+ if (i == nrofopenhandles) {
+ WARN(reg, "Could not find handle %x\n",hkey);
+ return ERROR_INVALID_HANDLE;
+ }
+
+ memcpy( openhandles+i,
+ openhandles+i+1,
+ sizeof(struct openhandle)*(nrofopenhandles-i-1)
+ );
+ openhandles=xrealloc(openhandles,sizeof(struct openhandle)*(nrofopenhandles-1));
+ nrofopenhandles--;
+ return ERROR_SUCCESS;
}
/* debug function, converts a unicode into a static memory area
* (sub for using two static strings, in case we need them in a single call)
+ *
+ * FIXME
+ * This seems to be used the same as debugstr_w.
+ * If so, can this one go away?
*/
LPSTR
W2C(LPCWSTR x,int sub) {
@@ -179,11 +233,20 @@
return unicodedebug[sub];
}
-static LPKEYSTRUCT
-lookup_hkey(HKEY hkey) {
+
+/******************************************************************************
+ * lookup_hkey [Internal]
+ *
+ * RETURNS
+ * Success: Pointer to key structure
+ * Failure: NULL
+ */
+static LPKEYSTRUCT lookup_hkey( HKEY hkey )
+{
switch (hkey) {
- case 0x00000000:
- case 0x00000001:
+ /* These seem erroneous */
+ /* case 0x00000000: */
+ /* case 0x00000001: */
case HKEY_CLASSES_ROOT:
return key_classes_root;
case HKEY_CURRENT_USER:
@@ -204,42 +267,65 @@
/*NOTREACHED*/
}
-/*
+
+/******************************************************************************
+ * split_keypath [Internal]
* splits the unicode string 'wp' into an array of strings.
* the array is allocated by this function.
- * the number of components will be stored in 'wpc'
* Free the array using FREE_KEY_PATH
+ *
+ * PARAMS
+ * wp [I] String to split up
+ * wpv [O] Array of pointers to strings
+ * wpc [O] Number of components
*/
-static void
-split_keypath(LPCWSTR wp,LPWSTR **wpv,int *wpc) {
- int i,j,len;
- LPWSTR ws;
+static void split_keypath( LPCWSTR wp, LPWSTR **wpv, int *wpc)
+{
+ int i,j,len;
+ LPWSTR ws;
- ws = HEAP_strdupW( SystemHeap, 0, wp );
- *wpc = 1;
- for (i=0;ws[i];i++) {
- if (ws[i]=='\\') {
- ws[i]=0;
- (*wpc)++;
- }
- }
- len = i;
- *wpv = (LPWSTR*)HeapAlloc( SystemHeap, 0, sizeof(LPWSTR)*(*wpc+2));
- (*wpv)[0]= ws;
- j = 1;
- for (i=1;i<len;i++)
- if (ws[i-1]==0)
- (*wpv)[j++]=ws+i;
- (*wpv)[j]=NULL;
+ TRACE(reg,"(%s,%p,%p)\n",debugstr_w(wp),wpv,wpc);
+
+ ws = HEAP_strdupW( SystemHeap, 0, wp );
+
+ /* We know we have at least one substring */
+ *wpc = 1;
+
+ /* Replace each backslash with NULL, and increment the count */
+ for (i=0;ws[i];i++) {
+ if (ws[i]=='\\') {
+ ws[i]=0;
+ (*wpc)++;
+ }
+ }
+
+ len = i;
+
+ /* Allocate the space for the array of pointers, leaving room for the
+ NULL at the end */
+ *wpv = (LPWSTR*)HeapAlloc( SystemHeap, 0, sizeof(LPWSTR)*(*wpc+2));
+ (*wpv)[0]= ws;
+
+ /* Assign each pointer to the appropriate character in the string */
+ j = 1;
+ for (i=1;i<len;i++)
+ if (ws[i-1]==0) {
+ (*wpv)[j++]=ws+i;
+ /* TRACE(reg, " Subitem %d = %s\n",j-1,debugstr_w((*wpv)[j-1])); */
+ }
+
+ (*wpv)[j]=NULL;
}
#define FREE_KEY_PATH HeapFree(SystemHeap,0,wps[0]);HeapFree(SystemHeap,0,wps);
-/*
+
+
+
+/******************************************************************************
+ * SHELL_Init [Internal]
* Shell initialisation, allocates keys.
*/
-void SHELL_StartupRegistry();
-void
-SHELL_Init() {
+void SHELL_Init() {
struct passwd *pwd;
HKEY cl_r_hkey,c_u_hkey;
@@ -249,8 +335,8 @@
xx->keyname= strdupA2W("<should_not_appear_anywhere>");
ADD_ROOT_KEY(key_local_machine);
- if (RegCreateKey16(HKEY_LOCAL_MACHINE,"\\SOFTWARE\\Classes",&cl_r_hkey)!=ERROR_SUCCESS) {
- ERR(reg,"couldn't create HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes. This is impossible.\n");
+ if (RegCreateKey16(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes",&cl_r_hkey)!=ERROR_SUCCESS) {
+ ERR(reg,"Could not create HKLM\\SOFTWARE\\Classes. This is impossible.\n");
exit(1);
}
key_classes_root = lookup_hkey(cl_r_hkey);
@@ -283,17 +369,25 @@
}
-void
-SHELL_StartupRegistry() {
+/******************************************************************************
+ * SHELL_StartupRegistry [Internal]
+ */
+void SHELL_StartupRegistry( void )
+{
HKEY hkey;
char buf[200];
- RegCreateKey16(HKEY_DYN_DATA,"\\PerfStats\\StatData",&hkey);
+ TRACE(reg,"(void)\n");
+
+ RegCreateKey16(HKEY_DYN_DATA,"PerfStats\\StatData",&hkey);
RegCloseKey(hkey);
- RegOpenKey16(HKEY_LOCAL_MACHINE,"\\HARDWARE\\DESCRIPTION\\System",&hkey);
+ /* This was an Open, but since it is called before the real registries
+ are loaded, it was changed to a Create - MTB 980507*/
+ RegCreateKey16(HKEY_LOCAL_MACHINE,"HARDWARE\\DESCRIPTION\\System",&hkey);
RegSetValueEx32A(hkey,"Identifier",0,REG_SZ,"SystemType WINE",strlen("SystemType WINE"));
RegCloseKey(hkey);
+
/* \\SOFTWARE\\Microsoft\\Window NT\\CurrentVersion
* CurrentVersion
* CurrentBuildNumber
@@ -313,6 +407,8 @@
RegCloseKey(hkey);
}
}
+
+
/************************ SAVE Registry Function ****************************/
#define REGISTRY_SAVE_VERSION 0x00000001
@@ -454,14 +550,20 @@
return TRUE;
}
-void
-SHELL_SaveRegistry() {
+
+/******************************************************************************
+ * SHELL_SaveRegistry [Internal]
+ */
+void SHELL_SaveRegistry( void )
+{
char *fn;
struct passwd *pwd;
char buf[4];
HKEY hkey;
int all;
+ TRACE(reg,"(void)\n");
+
all=0;
if (RegOpenKey16(HKEY_CURRENT_USER,KEY_REGISTRY,&hkey)!=ERROR_SUCCESS) {
strcpy(buf,"yes");
@@ -524,11 +626,15 @@
/************************ LOAD Registry Function ****************************/
-static LPKEYSTRUCT
-_find_or_add_key(LPKEYSTRUCT lpkey,LPWSTR keyname) {
+
+/******************************************************************************
+ * _find_or_add_key [Internal]
+ */
+static LPKEYSTRUCT _find_or_add_key( LPKEYSTRUCT lpkey, LPWSTR keyname )
+{
LPKEYSTRUCT lpxkey,*lplpkey;
- if (keyname[0]==0) {
+ if ((!keyname) || (keyname[0]==0)) {
free(keyname);
return lpkey;
}
@@ -695,33 +801,47 @@
return s;
}
-static int
-_wine_loadsubkey(
- FILE *F,LPKEYSTRUCT lpkey,int level,char **buf,int *buflen,int optflag
-) {
+
+/******************************************************************************
+ * _wine_loadsubkey [Internal]
+ *
+ * NOTES
+ * It seems like this is returning a boolean. Should it?
+ *
+ * RETURNS
+ * Success: 1
+ * Failure: 0
+ */
+static int _wine_loadsubkey( FILE *F, LPKEYSTRUCT lpkey, int level, char **buf,
+ int *buflen, DWORD optflag )
+{
LPKEYSTRUCT lpxkey;
int i;
char *s;
LPWSTR name;
- lpkey->flags |= optflag;
+ TRACE(reg,"(%p,%p,%d,%s,%d,%lx)\n", F, lpkey, level, debugstr_a(*buf),
+ *buflen, optflag);
- /* good. we already got a line here ... so parse it */
- lpxkey = NULL;
- while (1) {
- i=0;s=*buf;
- while (*s=='\t') {
- s++;
- i++;
- }
- if (i>level) {
- if (lpxkey==NULL) {
- WARN(reg,"Got a subhierarchy without resp. key?\n");
- return 0;
- }
- _wine_loadsubkey(F,lpxkey,level+1,buf,buflen,optflag);
- continue;
- }
+ lpkey->flags |= optflag;
+
+ /* Good. We already got a line here ... so parse it */
+ lpxkey = NULL;
+ while (1) {
+ i=0;s=*buf;
+ while (*s=='\t') {
+ s++;
+ i++;
+ }
+ if (i>level) {
+ if (lpxkey==NULL) {
+ WARN(reg,"Got a subhierarchy without resp. key?\n");
+ return 0;
+ }
+ _wine_loadsubkey(F,lpxkey,level+1,buf,buflen,optflag);
+ continue;
+ }
+
/* let the caller handle this line */
if (i<level || **buf=='\0')
return 1;
@@ -783,12 +903,16 @@
/* read the next line */
if (!_wine_read_line(F,buf,buflen))
return 1;
- }
- return 1;
+ }
+ return 1;
}
-static int
-_wine_loadsubreg(FILE *F,LPKEYSTRUCT lpkey,int optflag) {
+
+/******************************************************************************
+ * _wine_loadsubreg [Internal]
+ */
+static int _wine_loadsubreg( FILE *F, LPKEYSTRUCT lpkey, DWORD optflag )
+{
int ver;
char *buf;
int buflen;
@@ -819,27 +943,35 @@
return 1;
}
-static void
-_wine_loadreg(LPKEYSTRUCT lpkey,char *fn,int optflag) {
- FILE *F;
- F=fopen(fn,"rb");
- if (F==NULL) {
- WARN(reg,"Couldn't open %s for reading: %s\n",
- fn,strerror(errno)
- );
- return;
- }
- if (!_wine_loadsubreg(F,lpkey,optflag)) {
- fclose(F);
- unlink(fn);
- return;
- }
- fclose(F);
+/******************************************************************************
+ * _wine_loadreg [Internal]
+ */
+static void _wine_loadreg( LPKEYSTRUCT lpkey, char *fn, DWORD optflag )
+{
+ FILE *F;
+
+ TRACE(reg,"(%p,%s,%lx)\n",lpkey,debugstr_a(fn),optflag);
+
+ F = fopen(fn,"rb");
+ if (F==NULL) {
+ WARN(reg,"Couldn't open %s for reading: %s\n",fn,strerror(errno) );
+ return;
+ }
+ if (!_wine_loadsubreg(F,lpkey,optflag)) {
+ fclose(F);
+ unlink(fn);
+ return;
+ }
+ fclose(F);
}
-static void
-_copy_registry(LPKEYSTRUCT from,LPKEYSTRUCT to) {
+
+/******************************************************************************
+ * _copy_registry [Internal]
+ */
+static void _copy_registry( LPKEYSTRUCT from, LPKEYSTRUCT to )
+{
LPKEYSTRUCT lpxkey;
int j;
LPKEYVALUE valfrom;
@@ -872,6 +1004,7 @@
}
}
+
/* WINDOWS 95 REGISTRY LOADER */
/*
* Structure of a win95 registry database.
@@ -998,6 +1131,10 @@
return dest;
}
+
+/******************************************************************************
+ * _w95_processKey [Internal]
+ */
static LPKEYSTRUCT _w95_processKey ( LPKEYSTRUCT lpkey,
int nrLS, int nrMS, struct _w95_info *info )
@@ -1222,6 +1359,7 @@
free (info.rgknbuffer);
}
+
/* WINDOWS 31 REGISTRY LOADER, supplied by Tor Sjøwall, tor@sn.no */
/*
@@ -1357,8 +1495,11 @@
}
}
-void
-_w31_loadreg() {
+
+/******************************************************************************
+ * _w31_loadreg [Internal]
+ */
+void _w31_loadreg() {
HFILE32 hf;
struct _w31_header head;
struct _w31_tabent *tab;
@@ -1370,6 +1511,8 @@
HKEY hkey;
LPKEYSTRUCT lpkey;
+ TRACE(reg,"(void)\n");
+
hf = OpenFile32("reg.dat",&ofs,OF_READ);
if (hf==HFILE_ERROR32)
return;
@@ -1422,7 +1565,7 @@
}
lastmodified = DOSFS_FileTimeToUnixTime(&hfinfo.ftLastWriteTime,NULL);
- if (RegCreateKey16(HKEY_LOCAL_MACHINE,"\\SOFTWARE\\Classes",&hkey)!=ERROR_SUCCESS)
+ if (RegCreateKey16(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes",&hkey)!=ERROR_SUCCESS)
return;
lpkey = lookup_hkey(hkey);
__w31_dumptree(tab[0].w1,txt,tab,&head,lpkey,lastmodified,0);
@@ -1432,13 +1575,18 @@
return;
}
-void
-SHELL_LoadRegistry() {
+
+/**********************************************************************************
+ * SHELL_LoadRegistry [Internal]
+ */
+void SHELL_LoadRegistry( void )
+{
char *fn;
struct passwd *pwd;
LPKEYSTRUCT lpkey;
HKEY hkey;
+ TRACE(reg,"(void)\n");
if (key_classes_root==NULL)
SHELL_Init();
@@ -1453,6 +1601,8 @@
/* the global user default is loaded under HKEY_USERS\\.Default */
RegCreateKey16(HKEY_USERS,".Default",&hkey);
lpkey = lookup_hkey(hkey);
+ if(!lpkey)
+ WARN(reg,"Could not create global user default key\n");
_wine_loadreg(lpkey,SAVE_USERS_DEFAULT,0);
/* HKEY_USERS\\.Default is copied to HKEY_CURRENT_USER */
@@ -1515,114 +1665,127 @@
* RegOpenKey32W -> RegOpenKeyEx32W
*/
-/* RegOpenKeyExW [ADVAPI32.150] */
-DWORD WINAPI RegOpenKeyEx32W(
- HKEY hkey,
- LPCWSTR lpszSubKey,
- DWORD dwReserved,
- REGSAM samDesired,
- LPHKEY retkey
-) {
+
+/******************************************************************************
+ * RegOpenKeyEx32W [ADVAPI32.150]
+ * Opens the specified key
+ *
+ * Unlike RegCreateKeyEx, this does not create the key if it does not exist.
+ *
+ * PARAMS
+ * hkey [I] Handle of open key
+ * lpszSubKey [I] Name of subkey to open
+ * dwReserved [I] Reserved - must be zero
+ * samDesired [I] Security access mask
+ * retkey [O] Address of handle of open key
+ *
+ * RETURNS
+ * Success: ERROR_SUCCESS
+ * Failure: Error code
+ */
+DWORD WINAPI RegOpenKeyEx32W( HKEY hkey, LPCWSTR lpszSubKey, DWORD dwReserved,
+ REGSAM samDesired, LPHKEY retkey )
+{
LPKEYSTRUCT lpNextKey,lpxkey;
LPWSTR *wps;
int wpc,i;
- TRACE(reg,"(%lx,%s,%ld,%lx,%p)\n",
- (LONG)hkey,W2C(lpszSubKey,0),dwReserved,samDesired,retkey
- );
- lpNextKey = lookup_hkey(hkey);
- if (!lpNextKey)
- return SHELL_ERROR_BADKEY;
- if (!lpszSubKey || !*lpszSubKey) {
- add_handle(++currenthandle,lpNextKey,samDesired);
- *retkey=currenthandle;
- return SHELL_ERROR_SUCCESS;
- }
+ TRACE(reg,"(%x,%s,%ld,%lx,%p)\n", hkey,debugstr_w(lpszSubKey),dwReserved,
+ samDesired,retkey);
+
+ lpNextKey = lookup_hkey(hkey);
+ if (!lpNextKey) {
+ WARN(reg,"Invalid handle: %x\n",hkey);
+ return ERROR_INVALID_HANDLE;
+ }
+
+ if (!lpszSubKey || !*lpszSubKey) {
+ /* Either NULL or pointer to empty string, so return a new handle
+ to the original hkey */
+ add_handle(++currenthandle,lpNextKey,samDesired);
+ *retkey=currenthandle;
+ return ERROR_SUCCESS;
+ }
+
split_keypath(lpszSubKey,&wps,&wpc);
- i = 0;
+ i = 0;
while ((i<wpc) && (wps[i][0]=='\0')) i++;
- lpxkey = lpNextKey;
- while (wps[i]) {
- lpxkey=lpNextKey->nextsub;
- while (lpxkey) {
- if (!lstrcmpi32W(wps[i],lpxkey->keyname))
- break;
- lpxkey=lpxkey->next;
- }
- if (!lpxkey) {
- FREE_KEY_PATH;
- return SHELL_ERROR_BADKEY;
- }
- i++;
- lpNextKey = lpxkey;
- }
- add_handle(++currenthandle,lpxkey,samDesired);
- *retkey = currenthandle;
- FREE_KEY_PATH;
- return SHELL_ERROR_SUCCESS;
-}
+ lpxkey = lpNextKey;
-/* RegOpenKeyW [ADVAPI32.151] */
-DWORD WINAPI RegOpenKey32W(
- HKEY hkey,
- LPCWSTR lpszSubKey,
- LPHKEY retkey
-) {
- TRACE(reg,"(%lx,%s,%p)\n",
- (LONG)hkey,W2C(lpszSubKey,0),retkey
- );
- return RegOpenKeyEx32W(hkey,lpszSubKey,0,KEY_ALL_ACCESS,retkey);
+ while (wps[i]) {
+ lpxkey=lpNextKey->nextsub;
+ while (lpxkey) {
+ if (!lstrcmpi32W(wps[i],lpxkey->keyname)) {
+ break;
+ }
+ lpxkey=lpxkey->next;
+ }
+
+ if (!lpxkey) {
+ TRACE(reg,"Could not find subkey %s\n",debugstr_w(wps[i]));
+ FREE_KEY_PATH;
+ return ERROR_BADKEY;
+ }
+ i++;
+ lpNextKey = lpxkey;
+ }
+
+ add_handle(++currenthandle,lpxkey,samDesired);
+ *retkey = currenthandle;
+ TRACE(reg," Returning %x\n", currenthandle);
+ FREE_KEY_PATH;
+ return ERROR_SUCCESS;
}
-/* RegOpenKeyExA [ADVAPI32.149] */
-DWORD WINAPI RegOpenKeyEx32A(
- HKEY hkey,
- LPCSTR lpszSubKey,
- DWORD dwReserved,
- REGSAM samDesired,
- LPHKEY retkey
-) {
- LPWSTR lpszSubKeyW;
- DWORD ret;
-
- TRACE(reg,"(%lx,%s,%ld,%lx,%p)\n",
- (LONG)hkey,lpszSubKey,dwReserved,samDesired,retkey
- );
- if (lpszSubKey)
- lpszSubKeyW=strdupA2W(lpszSubKey);
- else
- lpszSubKeyW=NULL;
- ret=RegOpenKeyEx32W(hkey,lpszSubKeyW,dwReserved,samDesired,retkey);
- if (lpszSubKeyW)
- free(lpszSubKeyW);
- return ret;
+/******************************************************************************
+ * RegOpenKey32W [ADVAPI32.151]
+ */
+DWORD WINAPI RegOpenKey32W( HKEY hkey, LPCWSTR lpszSubKey, LPHKEY retkey )
+{
+ TRACE(reg,"(%x,%s,%p)\n",hkey,debugstr_w(lpszSubKey),retkey);
+ return RegOpenKeyEx32W(hkey,lpszSubKey,0,KEY_ALL_ACCESS,retkey);
}
-/* RegOpenKeyA [ADVAPI32.148] */
-DWORD WINAPI RegOpenKey32A(
- HKEY hkey,
- LPCSTR lpszSubKey,
- LPHKEY retkey
-) {
- TRACE(reg,"(%lx,%s,%p)\n",
- (LONG)hkey,lpszSubKey,retkey
- );
- return RegOpenKeyEx32A(hkey,lpszSubKey,0,KEY_ALL_ACCESS,retkey);
+
+/******************************************************************************
+ * RegOpenKeyEx32A [ADVAPI32.149]
+ */
+DWORD WINAPI RegOpenKeyEx32A( HKEY hkey, LPCSTR lpszSubKey, DWORD dwReserved,
+ REGSAM samDesired, LPHKEY retkey )
+{
+ LPWSTR lpszSubKeyW = HEAP_strdupAtoW(GetProcessHeap(),0,lpszSubKey);
+ DWORD ret;
+
+ TRACE(reg,"(%x,%s,%ld,%lx,%p)\n",hkey,debugstr_a(lpszSubKey),dwReserved,
+ samDesired,retkey);
+
+ ret = RegOpenKeyEx32W(hkey,lpszSubKeyW,dwReserved,samDesired,retkey);
+ HeapFree(GetProcessHeap(),0,lpszSubKeyW);
+ return ret;
}
-/* RegOpenKey [SHELL.1] [KERNEL.217] */
-DWORD WINAPI RegOpenKey16(
- HKEY hkey,
- LPCSTR lpszSubKey,
- LPHKEY retkey
-) {
- TRACE(reg,"(%lx,%s,%p)\n",
- (LONG)hkey,lpszSubKey,retkey
- );
- return RegOpenKey32A(hkey,lpszSubKey,retkey);
+
+/******************************************************************************
+ * RegOpenKey32A [ADVAPI32.148]
+ */
+DWORD WINAPI RegOpenKey32A( HKEY hkey, LPCSTR lpszSubKey, LPHKEY retkey )
+{
+ TRACE(reg,"(%x,%s,%p)\n",hkey,debugstr_a(lpszSubKey),retkey);
+ return RegOpenKeyEx32A(hkey,lpszSubKey,0,KEY_ALL_ACCESS,retkey);
}
+
+/******************************************************************************
+ * RegOpenKey16 [SHELL.1] [KERNEL.217]
+ */
+DWORD WINAPI RegOpenKey16( HKEY hkey, LPCSTR lpszSubKey, LPHKEY retkey )
+{
+ TRACE(reg,"(%x,%s,%p)\n",hkey,debugstr_a(lpszSubKey),retkey);
+ return RegOpenKey32A(hkey,lpszSubKey,retkey);
+}
+
+
/*
* Create keys
*
@@ -1636,44 +1799,48 @@
* RegCreateKey32W -> RegCreateKeyEx32W
*/
-/* RegCreateKeyExW [ADVAPI32.131] */
-DWORD WINAPI RegCreateKeyEx32W(
- HKEY hkey,
- LPCWSTR lpszSubKey,
- DWORD dwReserved,
- LPWSTR lpszClass,
- DWORD fdwOptions,
- REGSAM samDesired,
- LPSECURITY_ATTRIBUTES lpSecAttribs,
- LPHKEY retkey,
- LPDWORD lpDispos
-) {
+
+/******************************************************************************
+ * RegCreateKeyEx32W [ADVAPI32.131]
+ *
+ * PARAMS
+ * ...
+ * retkey [O] Address of buffer for opened handle
+ * lpDispos [O] Receives REG_CREATED_NEW_KEY or REG_OPENED_EXISTING_KEY
+ */
+DWORD WINAPI RegCreateKeyEx32W( HKEY hkey, LPCWSTR lpszSubKey,
+ DWORD dwReserved, LPWSTR lpszClass,
+ DWORD fdwOptions, REGSAM samDesired,
+ LPSECURITY_ATTRIBUTES lpSecAttribs,
+ LPHKEY retkey, LPDWORD lpDispos )
+{
LPKEYSTRUCT *lplpPrevKey,lpNextKey,lpxkey;
LPWSTR *wps;
int wpc,i;
-/*FIXME: handle security/access/whatever */
- TRACE(reg,"(%lx,%s,%ld,%s,%lx,%lx,%p,%p,%p)\n",
- (LONG)hkey,
- W2C(lpszSubKey,0),
- dwReserved,
- W2C(lpszClass,1),
- fdwOptions,
- samDesired,
- lpSecAttribs,
- retkey,
- lpDispos
- );
+ /*FIXME: handle security/access/whatever */
- lpNextKey = lookup_hkey(hkey);
- if (!lpNextKey)
- return SHELL_ERROR_BADKEY;
+ TRACE(reg,"(%x,%s,%ld,%s,%lx,%lx,%p,%p,%p)\n", hkey,
+ debugstr_w(lpszSubKey), dwReserved, debugstr_w(lpszClass),
+ fdwOptions, samDesired, lpSecAttribs, retkey, lpDispos);
+
+ lpNextKey = lookup_hkey(hkey);
+ if (!lpNextKey)
+ return ERROR_BADKEY;
+
+ if (lpszSubKey[0] == '\\') {
+ WARN(reg,"Subkey %s must not begin with backslash.\n",debugstr_w(lpszSubKey));
+ return ERROR_BAD_PATHNAME;
+ }
+
if (!lpszSubKey || !*lpszSubKey) {
add_handle(++currenthandle,lpNextKey,samDesired);
*retkey=currenthandle;
+ TRACE(reg, "Returning %x\n", currenthandle);
lpNextKey->flags|=REG_OPTION_TAINTED;
- return SHELL_ERROR_SUCCESS;
+ return ERROR_SUCCESS;
}
+
split_keypath(lpszSubKey,&wps,&wpc);
i = 0;
while ((i<wpc) && (wps[i][0]=='\0')) i++;
@@ -1694,12 +1861,14 @@
add_handle(++currenthandle,lpxkey,samDesired);
lpxkey->flags |= REG_OPTION_TAINTED;
*retkey = currenthandle;
+ TRACE(reg, "Returning %x\n", currenthandle);
if (lpDispos)
*lpDispos = REG_OPENED_EXISTING_KEY;
FREE_KEY_PATH;
- return SHELL_ERROR_SUCCESS;
+ return ERROR_SUCCESS;
}
- /* good. now the hard part */
+
+ /* Good. Now the hard part */
while (wps[i]) {
lplpPrevKey = &(lpNextKey->nextsub);
lpxkey = *lplpPrevKey;
@@ -1710,9 +1879,11 @@
*lplpPrevKey=malloc(sizeof(KEYSTRUCT));
if (!*lplpPrevKey) {
FREE_KEY_PATH;
- return SHELL_ERROR_OUTOFMEMORY;
+ TRACE(reg, "Returning OUTOFMEMORY\n");
+ return ERROR_OUTOFMEMORY;
}
memset(*lplpPrevKey,'\0',sizeof(KEYSTRUCT));
+ TRACE(reg,"Adding %s\n", debugstr_w(wps[i]));
(*lplpPrevKey)->keyname = strdupW(wps[i]);
(*lplpPrevKey)->next = NULL;
(*lplpPrevKey)->nextsub = NULL;
@@ -1735,100 +1906,78 @@
else
lpNextKey->class = NULL;
*retkey = currenthandle;
+ TRACE(reg, "Returning %x\n", currenthandle);
if (lpDispos)
*lpDispos = REG_CREATED_NEW_KEY;
FREE_KEY_PATH;
- return SHELL_ERROR_SUCCESS;
+ return ERROR_SUCCESS;
}
-/* RegCreateKeyW [ADVAPI32.132] */
-DWORD WINAPI RegCreateKey32W(
- HKEY hkey,
- LPCWSTR lpszSubKey,
- LPHKEY retkey
-) {
- DWORD junk,ret;
- TRACE(reg,"(%lx,%s,%p)\n",
- (LONG)hkey,W2C(lpszSubKey,0),retkey
- );
- ret=RegCreateKeyEx32W(
- hkey, /* key handle */
- lpszSubKey, /* subkey name */
- 0, /* reserved = 0 */
- NULL, /* lpszClass? FIXME: ? */
- REG_OPTION_NON_VOLATILE, /* options */
- KEY_ALL_ACCESS, /* desired access attribs */
- NULL, /* lpsecurity attributes */
- retkey, /* lpretkey */
- &junk /* disposition value */
- );
- return ret;
+/******************************************************************************
+ * RegCreateKey32W [ADVAPI32.132]
+ */
+DWORD WINAPI RegCreateKey32W( HKEY hkey, LPCWSTR lpszSubKey, LPHKEY retkey )
+{
+ DWORD junk;
+
+ TRACE(reg,"(%x,%s,%p)\n", hkey,debugstr_w(lpszSubKey),retkey);
+ return RegCreateKeyEx32W( hkey, lpszSubKey, 0, NULL,
+ REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS,NULL,
+ retkey, &junk);
}
-/* RegCreateKeyExA [ADVAPI32.130] */
-DWORD WINAPI RegCreateKeyEx32A(
- HKEY hkey,
- LPCSTR lpszSubKey,
- DWORD dwReserved,
- LPSTR lpszClass,
- DWORD fdwOptions,
- REGSAM samDesired,
- LPSECURITY_ATTRIBUTES lpSecAttribs,
- LPHKEY retkey,
- LPDWORD lpDispos
-) {
- LPWSTR lpszSubKeyW,lpszClassW;
- DWORD ret;
- TRACE(reg,"(%lx,%s,%ld,%s,%lx,%lx,%p,%p,%p)\n",
- (LONG)hkey,
- lpszSubKey,
- dwReserved,
- lpszClass,
- fdwOptions,
- samDesired,
- lpSecAttribs,
- retkey,
- lpDispos
- );
+/******************************************************************************
+ * RegCreateKeyEx32A [ADVAPI32.130]
+ */
+DWORD WINAPI RegCreateKeyEx32A( HKEY hkey, LPCSTR lpszSubKey, DWORD dwReserved,
+ LPSTR lpszClass, DWORD fdwOptions,
+ REGSAM samDesired,
+ LPSECURITY_ATTRIBUTES lpSecAttribs,
+ LPHKEY retkey, LPDWORD lpDispos )
+{
+ LPWSTR lpszSubKeyW, lpszClassW;
+ DWORD ret;
+
+ TRACE(reg,"(%x,%s,%ld,%s,%lx,%lx,%p,%p,%p)\n",hkey,debugstr_a(lpszSubKey),
+ dwReserved,debugstr_a(lpszClass),fdwOptions,samDesired,lpSecAttribs,
+ retkey,lpDispos);
+
+ lpszSubKeyW = HEAP_strdupAtoW(GetProcessHeap(),0,lpszSubKey);
+/*
if (lpszSubKey)
lpszSubKeyW=strdupA2W(lpszSubKey);
else
lpszSubKeyW=NULL;
+*/
if (lpszClass)
lpszClassW=strdupA2W(lpszClass);
else
lpszClassW=NULL;
- ret=RegCreateKeyEx32W(
- hkey,
- lpszSubKeyW,
- dwReserved,
- lpszClassW,
- fdwOptions,
- samDesired,
- lpSecAttribs,
- retkey,
- lpDispos
- );
+ ret = RegCreateKeyEx32W( hkey, lpszSubKeyW, dwReserved, lpszClassW,
+ fdwOptions, samDesired, lpSecAttribs, retkey,
+ lpDispos );
+ HeapFree(GetProcessHeap(),0,lpszSubKeyW);
+/*
if (lpszSubKeyW)
free(lpszSubKeyW);
+*/
if (lpszClassW)
free(lpszClassW);
- return ret;
+ return ret;
}
-/* RegCreateKeyA [ADVAPI32.129] */
-DWORD WINAPI RegCreateKey32A(
- HKEY hkey,
- LPCSTR lpszSubKey,
- LPHKEY retkey
-) {
- DWORD junk;
- TRACE(reg,"(%lx,%s,%p)\n",
- (LONG)hkey,lpszSubKey,retkey
- );
+/******************************************************************************
+ * RegCreateKey32A [ADVAPI32.129]
+ */
+DWORD WINAPI RegCreateKey32A( HKEY hkey, LPCSTR lpszSubKey, LPHKEY retkey )
+{
+ DWORD junk;
+
+ TRACE(reg,"(%x,%s,%p)\n",hkey,debugstr_a(lpszSubKey),retkey);
+
return RegCreateKeyEx32A(
hkey, /* key handle */
lpszSubKey, /* subkey name */
@@ -1842,18 +1991,17 @@
);
}
-/* RegCreateKey [SHELL.2] [KERNEL.218] */
-DWORD WINAPI RegCreateKey16(
- HKEY hkey,
- LPCSTR lpszSubKey,
- LPHKEY retkey
-) {
- TRACE(reg,"(%lx,%s,%p)\n",
- (LONG)hkey,lpszSubKey,retkey
- );
- return RegCreateKey32A(hkey,lpszSubKey,retkey);
+
+/******************************************************************************
+ * RegCreateKey16 [SHELL.2] [KERNEL.218]
+ */
+DWORD WINAPI RegCreateKey16( HKEY hkey, LPCSTR lpszSubKey, LPHKEY retkey )
+{
+ TRACE(reg,"(%x,%s,%p)\n",hkey,debugstr_a(lpszSubKey),retkey);
+ return RegCreateKey32A( hkey, lpszSubKey, retkey );
}
+
/*
* Query Value Functions
* Win32 differs between keynames and valuenames.
@@ -1866,81 +2014,140 @@
* RegQueryValue32W -> RegQueryValueEx32W
*/
-/* RegQueryValueExW [ADVAPI32.158] */
-DWORD WINAPI RegQueryValueEx32W(
- HKEY hkey,
- LPWSTR lpszValueName,
- LPDWORD lpdwReserved,
- LPDWORD lpdwType,
- LPBYTE lpbData,
- LPDWORD lpcbData
-) {
+
+/******************************************************************************
+ * RegQueryValueEx32W [ADVAPI32.158]
+ * Retrieves type and data for a specified name associated with an open key
+ *
+ * PARAMS
+ * hkey [I] Handle of key to query
+ * lpValueName [I] Name of value to query
+ * lpdwReserved [I] Reserved - must be NULL
+ * lpdwType [O] Address of buffer for value type. If NULL, the type
+ * is not required.
+ * lpbData [O] Address of data buffer. If NULL, the actual data is
+ * not required.
+ * lpcbData [I/O] Address of data buffer size
+ *
+ * RETURNS
+ * ERROR_SUCCESS: Success
+ * ERROR_MORE_DATA: The specified buffer is not big enough to hold the data
+ */
+DWORD WINAPI RegQueryValueEx32W( HKEY hkey, LPWSTR lpValueName,
+ LPDWORD lpdwReserved, LPDWORD lpdwType,
+ LPBYTE lpbData, LPDWORD lpcbData )
+{
LPKEYSTRUCT lpkey;
int i;
- TRACE(reg,"(%x,%s,%p,%p,%p,%ld)\n",
- hkey,W2C(lpszValueName,0),lpdwReserved,lpdwType,lpbData,
- lpcbData?*lpcbData:0);
+ TRACE(reg,"(%x,%s,%p,%p,%p,%ld)\n", hkey, debugstr_w(lpValueName),
+ lpdwReserved, lpdwType, lpbData, lpcbData?*lpcbData:0);
- lpkey = lookup_hkey(hkey);
- if (!lpkey)
- return SHELL_ERROR_BADKEY;
- if (lpszValueName && !*lpszValueName)
- lpszValueName = NULL;
- if (lpszValueName==NULL) {
+ lpkey = lookup_hkey(hkey);
+ if (!lpkey) {
+ TRACE(reg, "Invalid handle(%x)\n",hkey);
+ return ERROR_INVALID_HANDLE;
+ }
+
+ /* An empty name string is equivalent to NULL */
+ if (lpValueName && !*lpValueName)
+ lpValueName = NULL;
+
+ if (lpValueName==NULL) {
+ /* Use key's unnamed or default value, if any */
for (i=0;i<lpkey->nrofvalues;i++)
if (lpkey->values[i].name==NULL)
break;
} else {
+ /* Search for the key name */
for (i=0;i<lpkey->nrofvalues;i++)
if ( lpkey->values[i].name &&
- !lstrcmpi32W(lpszValueName,lpkey->values[i].name)
+ !lstrcmpi32W(lpValueName,lpkey->values[i].name)
)
break;
}
+
if (i==lpkey->nrofvalues) {
- if (lpszValueName==NULL) {
+ TRACE(reg,"Key not found\n");
+ if (lpValueName==NULL) {
+ /* Empty keyname not found */
if (lpbData) {
*(WCHAR*)lpbData = 0;
*lpcbData = 2;
}
if (lpdwType)
*lpdwType = REG_SZ;
- return SHELL_ERROR_SUCCESS;
+ TRACE(reg, "Returning an empty string\n");
+ return ERROR_SUCCESS;
}
- return SHELL_ERROR_BADKEY;/*FIXME: correct return? */
+ return ERROR_BADKEY; /* FIXME */
}
- if (lpdwType)
- *lpdwType = lpkey->values[i].type;
- if (lpbData==NULL) {
- if (lpcbData==NULL)
- return SHELL_ERROR_SUCCESS;
- *lpcbData = lpkey->values[i].len;
- return SHELL_ERROR_SUCCESS;
- }
- if (*lpcbData<lpkey->values[i].len) {
- *(WCHAR*)lpbData= 0;
- *lpcbData = lpkey->values[i].len;
- return ERROR_MORE_DATA;
- }
- memcpy(lpbData,lpkey->values[i].data,lpkey->values[i].len);
- *lpcbData = lpkey->values[i].len;
- return SHELL_ERROR_SUCCESS;
+
+ if (lpdwType)
+ *lpdwType = lpkey->values[i].type;
+
+ if (lpbData==NULL) {
+ /* Data is not required */
+ if (lpcbData==NULL) {
+ /* And data size is not required */
+ /* So all that is returned is the type (set above) */
+ return ERROR_SUCCESS;
+ }
+ /* Set the size required and return success */
+ *lpcbData = lpkey->values[i].len;
+ return ERROR_SUCCESS;
+ }
+
+ if (*lpcbData<lpkey->values[i].len) {
+ /* The size was specified, but the data is too big for it */
+ /* Instead of setting it to NULL, fill in with as much as possible */
+ /* But the docs do not specify how to handle the lpbData here */
+ /* *(WCHAR*)lpbData= 0; */
+ memcpy(lpbData,lpkey->values[i].data,*lpcbData);
+ *lpcbData = lpkey->values[i].len;
+ return ERROR_MORE_DATA;
+ }
+
+ memcpy(lpbData,lpkey->values[i].data,lpkey->values[i].len);
+
+ /* Extra debugging output */
+ if (lpdwType) {
+ switch(*lpdwType){
+ case REG_SZ:
+ TRACE(reg," Data(sz)=%s\n",debugstr_w((LPCWSTR)lpbData));
+ break;
+ case REG_DWORD:
+ TRACE(reg," Data(dword)=%lx\n", (DWORD)*lpbData);
+ break;
+ case REG_BINARY:
+ TRACE(reg," Data(binary)\n");
+ /* Is there a way of printing this in readable form? */
+ break;
+ default:
+ TRACE(reg, "Unknown data type %ld\n", *lpdwType);
+ } /* switch */
+ } /* if */
+
+ /* Set the actual size */
+ *lpcbData = lpkey->values[i].len;
+ return ERROR_SUCCESS;
}
-/* RegQueryValueW [ADVAPI32.159] */
-DWORD WINAPI RegQueryValue32W(
- HKEY hkey,
- LPWSTR lpszSubKey,
- LPWSTR lpszData,
- LPDWORD lpcbData
-) {
+
+/******************************************************************************
+ * RegQueryValue32W [ADVAPI32.159]
+ *
+ * NOTES
+ * Why is this calling RegOpenKey32W?
+ */
+DWORD WINAPI RegQueryValue32W( HKEY hkey, LPWSTR lpszSubKey, LPWSTR lpszData,
+ LPDWORD lpcbData )
+{
HKEY xhkey;
DWORD ret,lpdwType;
- TRACE(reg,"(%x,%s,%p,%ld)\n",
- hkey,W2C(lpszSubKey,0),lpszData,
- lpcbData?*lpcbData:0);
+ TRACE(reg,"(%x,%s,%p,%ld)\n",hkey,debugstr_w(lpszSubKey),lpszData,
+ lpcbData?*lpcbData:0);
/* only open subkey, if we really do descend */
if (lpszSubKey && *lpszSubKey) {
@@ -1964,37 +2171,38 @@
return ret;
}
-/* RegQueryValueExA [ADVAPI32.157] */
-DWORD WINAPI RegQueryValueEx32A(
- HKEY hkey,
- LPSTR lpszValueName,
- LPDWORD lpdwReserved,
- LPDWORD lpdwType,
- LPBYTE lpbData,
- LPDWORD lpcbData
-) {
+
+/******************************************************************************
+ * RegQueryValueEx32A [ADVAPI32.157]
+ *
+ * Can this use HEAP_strdupAtoW?
+ */
+DWORD WINAPI RegQueryValueEx32A( HKEY hkey, LPSTR lpszValueName,
+ LPDWORD lpdwReserved, LPDWORD lpdwType,
+ LPBYTE lpbData, LPDWORD lpcbData )
+{
LPWSTR lpszValueNameW;
LPBYTE buf;
DWORD ret,myxlen;
DWORD *mylen;
DWORD type;
- TRACE(reg,"(%x,%s,%p,%p,%p,%ld)\n",
- hkey,lpszValueName,lpdwReserved,lpdwType,lpbData,
- lpcbData?*lpcbData:0);
+ TRACE(reg,"(%x,%s,%p,%p,%p,%ld)\n", hkey,debugstr_a(lpszValueName),
+ lpdwReserved,lpdwType,lpbData,lpcbData?*lpcbData:0);
- if (lpszValueName)
- lpszValueNameW=strdupA2W(lpszValueName);
- else
- lpszValueNameW=NULL;
+ if (lpszValueName)
+ lpszValueNameW=strdupA2W(lpszValueName);
+ else
+ lpszValueNameW=NULL;
- if (lpdwType)
- type=*lpdwType;
+ if (lpdwType)
+ type=*lpdwType;
if (lpbData) {
myxlen = 0;
mylen = &myxlen;
buf = xmalloc(4);
+ /* Only get the size for now */
ret=RegQueryValueEx32W(
hkey,
lpszValueNameW,
@@ -2018,6 +2226,7 @@
} else
mylen = NULL;
}
+ /* Now get the data */
ret=RegQueryValueEx32W(
hkey,
lpszValueNameW,
@@ -2028,6 +2237,7 @@
);
if (lpdwType)
*lpdwType=type;
+
if (ret==ERROR_SUCCESS) {
if (buf) {
if (UNICONVMASK & (1<<(type))) {
@@ -2052,33 +2262,31 @@
}
if (buf)
free(buf);
- return ret;
+
+ return ret;
}
-/* RegQueryValueEx [KERNEL.225] */
-DWORD WINAPI RegQueryValueEx16(
- HKEY hkey,
- LPSTR lpszValueName,
- LPDWORD lpdwReserved,
- LPDWORD lpdwType,
- LPBYTE lpbData,
- LPDWORD lpcbData
-) {
- TRACE(reg,"(%x,%s,%p,%p,%p,%ld)\n",
- hkey,lpszValueName,lpdwReserved,lpdwType,lpbData,
- lpcbData?*lpcbData:0);
- return RegQueryValueEx32A(
- hkey,
- lpszValueName,
- lpdwReserved,
- lpdwType,
- lpbData,
- lpcbData
- );
+/******************************************************************************
+ * RegQueryValueEx16 [KERNEL.225]
+ */
+DWORD WINAPI RegQueryValueEx16( HKEY hkey, LPSTR lpszValueName,
+ LPDWORD lpdwReserved, LPDWORD lpdwType,
+ LPBYTE lpbData, LPDWORD lpcbData )
+{
+ TRACE(reg,"(%x,%s,%p,%p,%p,%ld)\n",hkey,debugstr_a(lpszValueName),
+ lpdwReserved,lpdwType,lpbData,lpcbData?*lpcbData:0);
+ return RegQueryValueEx32A( hkey, lpszValueName, lpdwReserved, lpdwType,
+ lpbData, lpcbData );
}
-/* RegQueryValueA [ADVAPI32.156] */
+
+/******************************************************************************
+ * RegQueryValue32A [ADVAPI32.156]
+ *
+ * NOTES
+ * Why is this calling RegOpenKey16?
+ */
DWORD WINAPI RegQueryValue32A(
HKEY hkey,
LPSTR lpszSubKey,
@@ -2088,13 +2296,12 @@
HKEY xhkey;
DWORD ret,lpdwType;
- TRACE(reg,"(%x,%s,%p,%ld)\n",
- hkey,lpszSubKey,lpszData,
- lpcbData?*lpcbData:0);
+ TRACE(reg,"(%x,%s,%p,%ld)\n",hkey,debugstr_a(lpszSubKey),lpszData,
+ lpcbData?*lpcbData:0);
/* only open subkey, if we really do descend */
if (lpszSubKey && *lpszSubKey) {
- ret = RegOpenKey16(hkey,lpszSubKey,&xhkey);
+ ret = RegOpenKey16(hkey,lpszSubKey,&xhkey);
if (ret!=ERROR_SUCCESS)
return ret;
} else
@@ -2114,25 +2321,30 @@
return ret;
}
-/* RegQueryValue [SHELL.6] [KERNEL.224] */
-DWORD WINAPI RegQueryValue16(
- HKEY hkey,
- LPSTR lpszSubKey,
- LPSTR lpszData,
- LPDWORD lpcbData
-) {
- TRACE(reg,"(%x,%s,%p,%ld)\n",
- hkey,lpszSubKey,lpszData,lpcbData?*lpcbData:0);
- /* HACK: the 16bit RegQueryValue doesn't handle selectorblocks
- * anyway, so we just mask out the high 16 bit.
- * (this (not so much incidently;) hopefully fixes Aldus FH4)
- */
- if (lpcbData)
- *lpcbData &= 0xFFFF;
- return RegQueryValue32A(hkey,lpszSubKey,lpszData,lpcbData);
+/******************************************************************************
+ * RegQueryValue16 [SHELL.6] [KERNEL.224]
+ *
+ * NOTES
+ * Is this HACK still applicable?
+ *
+ * HACK
+ * The 16bit RegQueryValue doesn't handle selectorblocks anyway, so we just
+ * mask out the high 16 bit. This (not so much incidently) hopefully fixes
+ * Aldus FH4)
+ */
+DWORD WINAPI RegQueryValue16( HKEY hkey, LPSTR lpszSubKey, LPSTR lpszData,
+ LPDWORD lpcbData )
+{
+ TRACE(reg,"(%x,%s,%p,%ld)\n",hkey,debugstr_a(lpszSubKey),lpszData,
+ lpcbData?*lpcbData:0);
+
+ if (lpcbData)
+ *lpcbData &= 0xFFFF;
+ return RegQueryValue32A(hkey,lpszSubKey,lpszData,lpcbData);
}
+
/*
* Setting values of Registry keys
*
@@ -2141,29 +2353,57 @@
* RegSetValue32W -> RegSetValueEx32W
*/
-/* RegSetValueExW [ADVAPI32.170] */
-DWORD WINAPI RegSetValueEx32W(
- HKEY hkey,
- LPWSTR lpszValueName,
- DWORD dwReserved,
- DWORD dwType,
- LPBYTE lpbData,
- DWORD cbData
-) {
- LPKEYSTRUCT lpkey;
- int i;
- TRACE(reg,"(%x,%s,%ld,%ld,%p,%ld)\n",
- hkey,W2C(lpszValueName,0),dwReserved,dwType,lpbData,cbData
- );
- /* we no longer care about the lpbData type here... */
- lpkey = lookup_hkey(hkey);
- if (!lpkey)
- return SHELL_ERROR_BADKEY;
+/******************************************************************************
+ * RegSetValueEx32W [ADVAPI32.170]
+ * Sets the data and type of a value under a register key
+ *
+ * PARAMS
+ * hkey [I] Handle of key to set value for
+ * lpszValueName [I] Name of value to set
+ * dwReserved [I] Reserved - must be zero
+ * dwType [I] Flag for value type
+ * lpbData [I] Address of value data
+ * cbData [I] Size of value data
+ *
+ * RETURNS
+ * Success: ERROR_SUCCESS
+ * Failure: Error code
+ */
+DWORD WINAPI RegSetValueEx32W( HKEY hkey, LPWSTR lpszValueName,
+ DWORD dwReserved, DWORD dwType, LPBYTE lpbData,
+ DWORD cbData)
+{
+ LPKEYSTRUCT lpkey;
+ int i;
+
+ TRACE(reg,"(%x,%s,%ld,%ld,%p,%ld)\n", hkey, debugstr_w(lpszValueName),
+ dwReserved, dwType, lpbData, cbData);
+
+ switch (dwType) {
+ case REG_SZ:
+ TRACE(reg," Data(sz)=%s\n", debugstr_w((LPCWSTR)lpbData));
+ break;
+ case REG_BINARY:
+ TRACE(reg," Data(binary)\n");
+ break;
+ case REG_DWORD:
+ TRACE(reg," Data(dword)=%lx\n", (DWORD)*lpbData);
+ break;
+ default:
+ TRACE(reg,"Unknown type: %ld\n", dwType);
+ }
+
+ lpkey = lookup_hkey(hkey);
+ if (!lpkey) {
+ WARN(reg,"Returning badkey\n");
+ return ERROR_INVALID_HANDLE;
+ }
lpkey->flags |= REG_OPTION_TAINTED;
if (lpszValueName==NULL) {
+ /* Sets type and name for key's unnamed or default value */
for (i=0;i<lpkey->nrofvalues;i++)
if (lpkey->values[i].name==NULL)
break;
@@ -2194,25 +2434,27 @@
lpkey->values[i].data = (LPBYTE)xmalloc(cbData);
lpkey->values[i].lastmodified = time(NULL);
memcpy(lpkey->values[i].data,lpbData,cbData);
- return SHELL_ERROR_SUCCESS;
+ return ERROR_SUCCESS;
}
-/* RegSetValueExA [ADVAPI32.169] */
-DWORD WINAPI RegSetValueEx32A(
- HKEY hkey,
- LPSTR lpszValueName,
- DWORD dwReserved,
- DWORD dwType,
- LPBYTE lpbData,
- DWORD cbData
-) {
+
+/******************************************************************************
+ * RegSetValueEx32A [ADVAPI32.169]
+ *
+ * NOTES
+ * Can this use the standard HEAP_strdupAtoW instead?
+ */
+DWORD WINAPI RegSetValueEx32A( HKEY hkey, LPSTR lpszValueName,
+ DWORD dwReserved, DWORD dwType, LPBYTE lpbData,
+ DWORD cbData )
+{
LPBYTE buf;
LPWSTR lpszValueNameW;
DWORD ret;
- TRACE(reg,"(%x,%s,%ld,%ld,%p,%ld)\n",
- hkey,lpszValueName,dwReserved,dwType,lpbData,cbData
- );
+ TRACE(reg,"(%x,%s,%ld,%ld,%p,%ld)\n",hkey,debugstr_a(lpszValueName),
+ dwReserved,dwType,lpbData,cbData);
+
if ((1<<dwType) & UNICONVMASK) {
buf=(LPBYTE)strdupA2W(lpbData);
cbData=2*strlen(lpbData)+2;
@@ -2230,22 +2472,23 @@
return ret;
}
-/* RegSetValueEx [KERNEL.226] */
-DWORD WINAPI RegSetValueEx16(
- HKEY hkey,
- LPSTR lpszValueName,
- DWORD dwReserved,
- DWORD dwType,
- LPBYTE lpbData,
- DWORD cbData
-) {
- TRACE(reg,"(%x,%s,%ld,%ld,%p,%ld)\n",
- hkey,lpszValueName,dwReserved,dwType,lpbData,cbData
- );
- return RegSetValueEx32A(hkey,lpszValueName,dwReserved,dwType,lpbData,cbData);
+
+/******************************************************************************
+ * RegSetValueEx16 [KERNEL.226]
+ */
+DWORD WINAPI RegSetValueEx16( HKEY hkey, LPSTR lpszValueName, DWORD dwReserved,
+ DWORD dwType, LPBYTE lpbData, DWORD cbData )
+{
+ TRACE(reg,"(%x,%s,%ld,%ld,%p,%ld)\n",hkey,debugstr_a(lpszValueName),
+ dwReserved,dwType,lpbData,cbData);
+ return RegSetValueEx32A( hkey, lpszValueName, dwReserved, dwType, lpbData,
+ cbData );
}
-/* RegSetValueW [ADVAPI32.171] */
+
+/******************************************************************************
+ * RegSetValue32W [ADVAPI32.171]
+ */
DWORD WINAPI RegSetValue32W(
HKEY hkey,
LPCWSTR lpszSubKey,
@@ -2279,9 +2522,15 @@
if (hkey!=xhkey)
RegCloseKey(xhkey);
return ret;
-
}
-/* RegSetValueA [ADVAPI32.168] */
+
+
+/******************************************************************************
+ * RegSetValue32A [ADVAPI32.168]
+ *
+ * NOTES
+ * Why is this calling RegCreateKey16?
+ */
DWORD WINAPI RegSetValue32A(
HKEY hkey,
LPCSTR lpszSubKey,
@@ -2314,22 +2563,19 @@
return ret;
}
-/* RegSetValue [KERNEL.221] [SHELL.5] */
-DWORD WINAPI RegSetValue16(
- HKEY hkey,
- LPCSTR lpszSubKey,
- DWORD dwType,
- LPCSTR lpszData,
- DWORD cbData
-) {
- DWORD ret;
- TRACE(reg,"(%x,%s,%ld,%s,%ld)\n",
- hkey,lpszSubKey,dwType,lpszData,cbData
- );
- ret=RegSetValue32A(hkey,lpszSubKey,dwType,lpszData,cbData);
- return ret;
+
+/******************************************************************************
+ * RegSetValue16 [KERNEL.221] [SHELL.5]
+ */
+DWORD WINAPI RegSetValue16( HKEY hkey, LPCSTR lpszSubKey, DWORD dwType,
+ LPCSTR lpszData, DWORD cbData )
+{
+ TRACE(reg,"(%x,%s,%ld,%s,%ld)\n",hkey,debugstr_a(lpszSubKey),dwType,
+ debugstr_a(lpszData),cbData);
+ return RegSetValue32A(hkey,lpszSubKey,dwType,lpszData,cbData);
}
+
/*
* Key Enumeration
*
@@ -2338,25 +2584,24 @@
* RegEnumKey32W -> RegEnumKeyEx32W
*/
-/* RegEnumKeyExW [ADVAPI32.139] */
-DWORD WINAPI RegEnumKeyEx32W(
- HKEY hkey,
- DWORD iSubkey,
- LPWSTR lpszName,
- LPDWORD lpcchName,
- LPDWORD lpdwReserved,
- LPWSTR lpszClass,
- LPDWORD lpcchClass,
- FILETIME *ft
-) {
+
+/******************************************************************************
+ * RegEnumKeyEx32W [ADVAPI32.139]
+ */
+DWORD WINAPI RegEnumKeyEx32W( HKEY hkey, DWORD iSubkey, LPWSTR lpszName,
+ LPDWORD lpcchName, LPDWORD lpdwReserved,
+ LPWSTR lpszClass, LPDWORD lpcchClass,
+ FILETIME *ft )
+{
LPKEYSTRUCT lpkey,lpxkey;
- TRACE(reg,"(%x,%ld,%p,%ld,%p,%p,%p,%p)\n",
- hkey,iSubkey,lpszName,*lpcchName,lpdwReserved,lpszClass,lpcchClass,ft
- );
- lpkey=lookup_hkey(hkey);
- if (!lpkey)
- return SHELL_ERROR_BADKEY;
+ TRACE(reg,"(%x,%ld,%p,%ld,%p,%p,%p,%p)\n",hkey,iSubkey,lpszName,
+ *lpcchName,lpdwReserved,lpszClass,lpcchClass,ft);
+
+ lpkey = lookup_hkey(hkey);
+ if (!lpkey)
+ return ERROR_INVALID_HANDLE;
+
if (!lpkey->nextsub)
return ERROR_NO_MORE_ITEMS;
lpxkey=lpkey->nextsub;
@@ -2375,23 +2620,22 @@
*lpcchClass = 2;
}
return ERROR_SUCCESS;
-
}
-/* RegEnumKeyW [ADVAPI32.140] */
-DWORD WINAPI RegEnumKey32W(
- HKEY hkey,
- DWORD iSubkey,
- LPWSTR lpszName,
- DWORD lpcchName
-) {
- FILETIME ft;
- TRACE(reg,"(%x,%ld,%p,%ld)\n",
- hkey,iSubkey,lpszName,lpcchName
- );
- return RegEnumKeyEx32W(hkey,iSubkey,lpszName,&lpcchName,NULL,NULL,NULL,&ft);
+/******************************************************************************
+ * RegEnumKey32W [ADVAPI32.140]
+ */
+DWORD WINAPI RegEnumKey32W( HKEY hkey, DWORD iSubkey, LPWSTR lpszName,
+ DWORD lpcchName )
+{
+ FILETIME ft;
+
+ TRACE(reg,"(%x,%ld,%p,%ld)\n",hkey,iSubkey,lpszName,lpcchName);
+ return RegEnumKeyEx32W(hkey,iSubkey,lpszName,&lpcchName,NULL,NULL,NULL,&ft);
}
+
+
/* RegEnumKeyExA [ADVAPI32.138] */
DWORD WINAPI RegEnumKeyEx32A(
HKEY hkey,
@@ -2449,43 +2693,32 @@
return ret;
}
-/* RegEnumKeyA [ADVAPI32.137] */
-DWORD WINAPI RegEnumKey32A(
- HKEY hkey,
- DWORD iSubkey,
- LPSTR lpszName,
- DWORD lpcchName
-) {
- FILETIME ft;
- TRACE(reg,"(%x,%ld,%p,%ld)\n",
- hkey,iSubkey,lpszName,lpcchName
- );
- return RegEnumKeyEx32A(
- hkey,
- iSubkey,
- lpszName,
- &lpcchName,
- NULL,
- NULL,
- NULL,
- &ft
- );
+/******************************************************************************
+ * RegEnumKey32A [ADVAPI32.137]
+ */
+DWORD WINAPI RegEnumKey32A( HKEY hkey, DWORD iSubkey, LPSTR lpszName,
+ DWORD lpcchName )
+{
+ FILETIME ft;
+
+ TRACE(reg,"(%x,%ld,%p,%ld)\n",hkey,iSubkey,lpszName,lpcchName);
+ return RegEnumKeyEx32A( hkey, iSubkey, lpszName, &lpcchName, NULL, NULL,
+ NULL, &ft );
}
-/* RegEnumKey [SHELL.7] [KERNEL.216] */
-DWORD WINAPI RegEnumKey16(
- HKEY hkey,
- DWORD iSubkey,
- LPSTR lpszName,
- DWORD lpcchName
-) {
- TRACE(reg,"(%x,%ld,%p,%ld)\n",
- hkey,iSubkey,lpszName,lpcchName
- );
- return RegEnumKey32A(hkey,iSubkey,lpszName,lpcchName);
+
+/******************************************************************************
+ * RegEnumKey16 [SHELL.7] [KERNEL.216]
+ */
+DWORD WINAPI RegEnumKey16( HKEY hkey, DWORD iSubkey, LPSTR lpszName,
+ DWORD lpcchName )
+{
+ TRACE(reg,"(%x,%ld,%p,%ld)\n",hkey,iSubkey,lpszName,lpcchName);
+ return RegEnumKey32A( hkey, iSubkey, lpszName, lpcchName);
}
+
/*
* Enumerate Registry Values
*
@@ -2493,11 +2726,14 @@
* RegEnumValue16 -> RegEnumValue32A -> RegEnumValue32W
*/
-/* RegEnumValueW [ADVAPI32.142] */
+
+/******************************************************************************
+ * RegEnumValue32W [ADVAPI32.142]
+ */
DWORD WINAPI RegEnumValue32W(
- HKEY hkey,
- DWORD iValue,
- LPWSTR lpszValue,
+ HKEY hkey,
+ DWORD iValue,
+ LPWSTR lpszValue,
LPDWORD lpcchValue,
LPDWORD lpdReserved,
LPDWORD lpdwType,
@@ -2512,7 +2748,8 @@
);
lpkey = lookup_hkey(hkey);
if (!lpkey)
- return SHELL_ERROR_BADKEY;
+ return ERROR_INVALID_HANDLE;
+
if (lpkey->nrofvalues<=iValue)
return ERROR_NO_MORE_ITEMS;
val = lpkey->values+iValue;
@@ -2536,9 +2773,10 @@
memcpy(lpbData,val->data,val->len);
*lpcbData = val->len;
}
- return SHELL_ERROR_SUCCESS;
+ return ERROR_SUCCESS;
}
+
/* RegEnumValueA [ADVAPI32.141] */
DWORD WINAPI RegEnumValue32A(
HKEY hkey,
@@ -2596,65 +2834,77 @@
return ret;
}
-/* RegEnumValue [KERNEL.223] */
-DWORD WINAPI RegEnumValue16(
- HKEY hkey,
- DWORD iValue,
- LPSTR lpszValue,
- LPDWORD lpcchValue,
- LPDWORD lpdReserved,
- LPDWORD lpdwType,
- LPBYTE lpbData,
- LPDWORD lpcbData
-) {
- TRACE(reg,"(%x,%ld,%p,%p,%p,%p,%p,%p)\n",
- hkey,iValue,lpszValue,lpcchValue,lpdReserved,lpdwType,lpbData,lpcbData
- );
- return RegEnumValue32A(
- hkey,
- iValue,
- lpszValue,
- lpcchValue,
- lpdReserved,
- lpdwType,
- lpbData,
- lpcbData
- );
+
+/******************************************************************************
+ * RegEnumValue16 [KERNEL.223]
+ */
+DWORD WINAPI RegEnumValue16( HKEY hkey, DWORD iValue, LPSTR lpszValue,
+ LPDWORD lpcchValue, LPDWORD lpdReserved,
+ LPDWORD lpdwType, LPBYTE lpbData,
+ LPDWORD lpcbData )
+{
+ TRACE(reg,"(%x,%ld,%p,%p,%p,%p,%p,%p)\n",hkey,iValue,lpszValue,lpcchValue,
+ lpdReserved,lpdwType,lpbData,lpcbData);
+ return RegEnumValue32A( hkey, iValue, lpszValue, lpcchValue, lpdReserved,
+ lpdwType, lpbData, lpcbData );
}
-/*
- * Close registry key
+
+/******************************************************************************
+ * RegCloseKey [SHELL.3] [KERNEL.220] [ADVAPI32.126]
+ * Releases the handle of the specified key
+ *
+ * PARAMS
+ * hkey [I] Handle of key to close
+ *
+ * RETURNS
+ * Success: ERROR_SUCCESS
+ * Failure: Error code
*/
-/* RegCloseKey [SHELL.3] [KERNEL.220] [ADVAPI32.126] */
-DWORD WINAPI RegCloseKey(HKEY hkey) {
- TRACE(reg,"(%x)\n",hkey);
- remove_handle(hkey);
- return ERROR_SUCCESS;
+DWORD WINAPI RegCloseKey( HKEY hkey )
+{
+ TRACE(reg,"(%x)\n",hkey);
+ return remove_handle(hkey);
}
+
+
/*
* Delete registry key
*
* Callpath:
* RegDeleteKey16 -> RegDeleteKey32A -> RegDeleteKey32W
*/
-/* RegDeleteKeyW [ADVAPI32.134] */
-DWORD WINAPI RegDeleteKey32W(HKEY hkey,LPWSTR lpszSubKey) {
+
+
+/******************************************************************************
+ * RegDeleteKey32W [ADVAPI32.134]
+ *
+ * PARAMS
+ * hkey [I]
+ * lpszSubKey [I]
+ *
+ * RETURNS
+ * Success: ERROR_SUCCESS
+ * Failure: Error code
+ */
+DWORD WINAPI RegDeleteKey32W( HKEY hkey, LPWSTR lpszSubKey )
+{
LPKEYSTRUCT *lplpPrevKey,lpNextKey,lpxkey;
LPWSTR *wps;
int wpc,i;
- TRACE(reg,"(%x,%s)\n",
- hkey,W2C(lpszSubKey,0)
- );
- lpNextKey = lookup_hkey(hkey);
- if (!lpNextKey) {
- TRACE(reg, " Badkey[1].\n");
- return SHELL_ERROR_BADKEY;
- }
+ TRACE(reg,"(%x,%s)\n",hkey,debugstr_w(lpszSubKey));
+
+ lpNextKey = lookup_hkey(hkey);
+ if (!lpNextKey) {
+ TRACE(reg, " Invalid handle.\n");
+ return ERROR_INVALID_HANDLE;
+ }
+
/* we need to know the previous key in the hier. */
if (!lpszSubKey || !*lpszSubKey) {
TRACE(reg, " Badkey[2].\n");
- return SHELL_ERROR_BADKEY;
+ return ERROR_BADKEY;
}
split_keypath(lpszSubKey,&wps,&wpc);
i = 0;
@@ -2672,7 +2922,7 @@
FREE_KEY_PATH;
TRACE(reg, " Not found.\n");
/* not found is success */
- return SHELL_ERROR_SUCCESS;
+ return ERROR_SUCCESS;
}
i++;
lpNextKey = lpxkey;
@@ -2687,15 +2937,17 @@
lplpPrevKey = &(lpxkey->next);
lpxkey = lpxkey->next;
}
+
if (!lpxkey) {
FREE_KEY_PATH;
WARN(reg , " Not found.\n");
- return SHELL_ERROR_BADKEY;
+ return ERROR_FILE_NOT_FOUND;
}
+
if (lpxkey->nextsub) {
FREE_KEY_PATH;
WARN(reg , " Not empty.\n");
- return SHELL_ERROR_CANTWRITE;
+ return ERROR_CANTWRITE;
}
*lplpPrevKey = lpxkey->next;
free(lpxkey->keyname);
@@ -2706,50 +2958,65 @@
free(lpxkey);
FREE_KEY_PATH;
TRACE(reg, " Done.\n");
- return SHELL_ERROR_SUCCESS;
+ return ERROR_SUCCESS;
}
-/* RegDeleteKeyA [ADVAPI32.133] */
-DWORD WINAPI RegDeleteKey32A(HKEY hkey,LPCSTR lpszSubKey) {
- LPWSTR lpszSubKeyW;
- DWORD ret;
- TRACE(reg,"(%x,%s)\n",
- hkey,lpszSubKey
- );
- lpszSubKeyW=HEAP_strdupAtoW(GetProcessHeap(),0,lpszSubKey);
- ret=RegDeleteKey32W(hkey,lpszSubKeyW);
- HeapFree(GetProcessHeap(),0,lpszSubKeyW);
- return ret;
+/******************************************************************************
+ * RegDeleteKey32A [ADVAPI32.133]
+ */
+DWORD WINAPI RegDeleteKey32A( HKEY hkey, LPCSTR lpszSubKey )
+{
+ LPWSTR lpszSubKeyW;
+ DWORD ret;
+
+ TRACE(reg,"(%x,%s)\n",hkey,lpszSubKey);
+ lpszSubKeyW = HEAP_strdupAtoW( GetProcessHeap(), 0, lpszSubKey );
+ ret = RegDeleteKey32W( hkey, lpszSubKeyW );
+ HeapFree( GetProcessHeap(), 0, lpszSubKeyW );
+ return ret;
}
-/* RegDeleteKey [SHELL.4] [KERNEL.219] */
-DWORD WINAPI RegDeleteKey16(HKEY hkey,LPCSTR lpszSubKey) {
- TRACE(reg,"(%x,%s)\n",
- hkey,lpszSubKey
- );
- return RegDeleteKey32A(hkey,lpszSubKey);
+
+/******************************************************************************
+ * RegDeleteKey16 [SHELL.4] [KERNEL.219]
+ */
+DWORD WINAPI RegDeleteKey16( HKEY hkey, LPCSTR lpszSubKey )
+{
+ TRACE(reg,"(%x,%s)\n",hkey,debugstr_a(lpszSubKey));
+ return RegDeleteKey32A( hkey, lpszSubKey );
}
+
/*
* Delete registry value
*
* Callpath:
* RegDeleteValue16 -> RegDeleteValue32A -> RegDeleteValue32W
*/
-/* RegDeleteValueW [ADVAPI32.136] */
-DWORD WINAPI RegDeleteValue32W(HKEY hkey,LPWSTR lpszValue)
+
+
+/******************************************************************************
+ * RegDeleteValue32W [ADVAPI32.136]
+ *
+ * PARAMS
+ * hkey [I]
+ * lpszValue [I]
+ *
+ * RETURNS
+ */
+DWORD WINAPI RegDeleteValue32W( HKEY hkey, LPWSTR lpszValue )
{
DWORD i;
LPKEYSTRUCT lpkey;
LPKEYVALUE val;
- TRACE(reg,"(%x,%s)\n",
- hkey,W2C(lpszValue,0)
- );
- lpkey=lookup_hkey(hkey);
- if (!lpkey)
- return SHELL_ERROR_BADKEY;
+ TRACE(reg,"(%x,%s)\n",hkey,debugstr_w(lpszValue));
+
+ lpkey = lookup_hkey(hkey);
+ if (!lpkey)
+ return ERROR_INVALID_HANDLE;
+
if (lpszValue) {
for (i=0;i<lpkey->nrofvalues;i++)
if ( lpkey->values[i].name &&
@@ -2761,8 +3028,10 @@
if (lpkey->values[i].name==NULL)
break;
}
- if (i==lpkey->nrofvalues)
- return SHELL_ERROR_BADKEY;/*FIXME: correct errorcode? */
+
+ if (i == lpkey->nrofvalues)
+ return ERROR_FILE_NOT_FOUND;
+
val = lpkey->values+i;
if (val->name) free(val->name);
if (val->data) free(val->data);
@@ -2776,27 +3045,33 @@
(lpkey->nrofvalues-1)*sizeof(KEYVALUE)
);
lpkey->nrofvalues--;
- return SHELL_ERROR_SUCCESS;
+ return ERROR_SUCCESS;
}
-/* RegDeleteValueA [ADVAPI32.135] */
-DWORD WINAPI RegDeleteValue32A(HKEY hkey,LPSTR lpszValue)
-{
- LPWSTR lpszValueW;
- DWORD ret;
- TRACE(reg, "(%x,%s)\n", hkey,lpszValue );
- lpszValueW=HEAP_strdupAtoW(GetProcessHeap(),0,lpszValue);
- ret=RegDeleteValue32W(hkey,lpszValueW);
- HeapFree(GetProcessHeap(),0,lpszValueW);
- return ret;
+/******************************************************************************
+ * RegDeleteValue32A [ADVAPI32.135]
+ */
+DWORD WINAPI RegDeleteValue32A( HKEY hkey, LPSTR lpszValue )
+{
+ LPWSTR lpszValueW;
+ DWORD ret;
+
+ TRACE(reg, "(%x,%s)\n",hkey,debugstr_a(lpszValue));
+ lpszValueW=HEAP_strdupAtoW(GetProcessHeap(),0,lpszValue);
+ ret = RegDeleteValue32W( hkey, lpszValueW );
+ HeapFree(GetProcessHeap(),0,lpszValueW);
+ return ret;
}
-/* RegDeleteValue [KERNEL.222] */
-DWORD WINAPI RegDeleteValue16(HKEY hkey,LPSTR lpszValue)
+
+/******************************************************************************
+ * RegDeleteValue16 [KERNEL.222]
+ */
+DWORD WINAPI RegDeleteValue16( HKEY hkey, LPSTR lpszValue )
{
- TRACE(reg,"(%x,%s)\n", hkey,lpszValue );
- return RegDeleteValue32A(hkey,lpszValue);
+ TRACE(reg,"(%x,%s)\n", hkey,debugstr_a(lpszValue));
+ return RegDeleteValue32A(hkey,lpszValue);
}
@@ -2820,7 +3095,9 @@
/* FIXME: lpcchXXXX ... is this counting in WCHARS or in BYTEs ?? */
-/* RegQueryInfoKeyW [ADVAPI32.153] */
+/******************************************************************************
+ * RegQueryInfoKey32W [ADVAPI32.153]
+ */
DWORD WINAPI RegQueryInfoKey32W(
HKEY hkey,
LPWSTR lpszClass,
@@ -2836,13 +3113,13 @@
FILETIME *ft
) {
LPKEYSTRUCT lpkey,lpxkey;
- int nrofkeys,maxsubkey,maxclass,maxvalues,maxvname,maxvdata;
+ int nrofkeys,maxsubkey,maxclass,maxvname,maxvdata;
int i;
TRACE(reg,"(%x,......)\n",hkey);
- lpkey=lookup_hkey(hkey);
+ lpkey = lookup_hkey(hkey);
if (!lpkey)
- return SHELL_ERROR_BADKEY;
+ return ERROR_INVALID_HANDLE;
if (lpszClass) {
if (lpkey->class) {
if (lstrlen32W(lpkey->class)*2+2>*lpcchClass) {
@@ -2860,42 +3137,41 @@
*lpcchClass = lstrlen32W(lpkey->class)*2;
}
lpxkey=lpkey->nextsub;
- nrofkeys=maxsubkey=maxclass=maxvalues=maxvname=maxvdata=0;
+ nrofkeys=maxsubkey=maxclass=maxvname=maxvdata=0;
while (lpxkey) {
nrofkeys++;
if (lstrlen32W(lpxkey->keyname)>maxsubkey)
maxsubkey=lstrlen32W(lpxkey->keyname);
if (lpxkey->class && lstrlen32W(lpxkey->class)>maxclass)
maxclass=lstrlen32W(lpxkey->class);
- if (lpxkey->nrofvalues>maxvalues)
- maxvalues=lpxkey->nrofvalues;
- for (i=0;i<lpxkey->nrofvalues;i++) {
- LPKEYVALUE val=lpxkey->values+i;
-
- if (val->name && lstrlen32W(val->name)>maxvname)
- maxvname=lstrlen32W(val->name);
- if (val->len>maxvdata)
- maxvdata=val->len;
- }
lpxkey=lpxkey->next;
}
+ for (i=0;i<lpkey->nrofvalues;i++) {
+ LPKEYVALUE val=lpkey->values+i;
+
+ if (val->name && lstrlen32W(val->name)>maxvname)
+ maxvname=lstrlen32W(val->name);
+ if (val->len>maxvdata)
+ maxvdata=val->len;
+ }
if (!maxclass) maxclass = 1;
if (!maxvname) maxvname = 1;
+ if (lpcValues)
+ *lpcValues = lpkey->nrofvalues;
if (lpcSubKeys)
*lpcSubKeys = nrofkeys;
if (lpcchMaxSubkey)
*lpcchMaxSubkey = maxsubkey*2;
if (lpcchMaxClass)
*lpcchMaxClass = maxclass*2;
- if (lpcValues)
- *lpcValues = maxvalues;
if (lpcchMaxValueName)
*lpcchMaxValueName= maxvname;
if (lpccbMaxValueData)
*lpccbMaxValueData= maxvdata;
- return SHELL_ERROR_SUCCESS;
+ return ERROR_SUCCESS;
}
+
/* RegQueryInfoKeyA [ADVAPI32.152] */
DWORD WINAPI RegQueryInfoKey32A(
HKEY hkey,
@@ -2949,11 +3225,28 @@
free(lpszClassW);
return ret;
}
-/* RegConnectRegistryA [ADVAPI32.127] */
-DWORD WINAPI RegConnectRegistry32A(LPCSTR machine,HKEY hkey,LPHKEY reskey)
+
+
+/******************************************************************************
+ * RegConnectRegistry32W [ADVAPI32.128]
+ */
+LONG WINAPI RegConnectRegistry32W( LPCWSTR machine, HKEY hkey, LPHKEY reskey )
{
- FIXME(reg,"(%s,%08x,%p):stub.\n",machine,hkey,reskey);
- return ERROR_FILE_NOT_FOUND; /* FIXME */
+ FIXME(reg,"(%s,%x,%p): stub\n",debugstr_w(machine),hkey,reskey);
+ return ERROR_BAD_NETPATH; /* FIXME */
+}
+
+
+/******************************************************************************
+ * RegConnectRegistry32A [ADVAPI32.127]
+ */
+LONG WINAPI RegConnectRegistry32A( LPCSTR machine, HKEY hkey, LPHKEY reskey )
+{
+ DWORD ret;
+ LPWSTR machineW = HEAP_strdupAtoW(GetProcessHeap(),0,machine);
+ ret = RegConnectRegistry32W( machineW, hkey, reskey );
+ HeapFree(GetProcessHeap(),0,machineW);
+ return ret;
}
@@ -2961,20 +3254,61 @@
* RegGetKeySecurity [ADVAPI32.144]
* Retrieves a copy of security descriptor protecting the registry key
*
- * NOTES
- * pSecurityDescriptor should be PSECURITY_DESCRIPTOR
- *
* RETURNS
* Success: ERROR_SUCCESS
* Failure: Error code
*/
-LONG WINAPI RegGetKeySecurity( HKEY hKey,
+LONG WINAPI RegGetKeySecurity( HKEY hkey,
SECURITY_INFORMATION SecurityInformation,
- LPVOID pSecurityDescriptor,
+ LPSECURITY_DESCRIPTOR pSecurityDescriptor,
LPDWORD lpcbSecurityDescriptor )
{
- FIXME(reg, "(%d,%ld,%p,%p): stub\n", hKey, SecurityInformation,
+ LPKEYSTRUCT lpkey;
+ lpkey = lookup_hkey(hkey);
+ if (!lpkey)
+ return ERROR_INVALID_HANDLE;
+
+ FIXME(reg, "(%d,%ld,%p,%p): stub\n", hkey, SecurityInformation,
pSecurityDescriptor, lpcbSecurityDescriptor);
return ERROR_SUCCESS;
}
+
+/******************************************************************************
+ * RegLoadKey32W [ADVAPI32.???]
+ */
+LONG WINAPI RegLoadKey32W( HKEY hkey, LPCWSTR lpszSubKey, LPCWSTR lpszFile )
+{
+ FIXME(reg,"(%x,%s,%s): stub\n",hkey,debugstr_w(lpszSubKey),
+ debugstr_w(lpszFile));
+ return ERROR_SUCCESS;
+}
+
+
+/******************************************************************************
+ * RegLoadKey32A [ADVAPI32.???]
+ */
+LONG WINAPI RegLoadKey32A( HKEY hkey, LPCSTR lpszSubKey, LPCSTR lpszFile )
+{
+ LONG ret;
+ LPWSTR lpszSubKeyW = HEAP_strdupAtoW(GetProcessHeap(),0,lpszSubKey);
+ LPWSTR lpszFileW = HEAP_strdupAtoW(GetProcessHeap(),0,lpszFile);
+ ret = RegLoadKey32W( hkey, lpszSubKeyW, lpszFileW );
+ HeapFree(GetProcessHeap(),0,lpszFileW);
+ HeapFree(GetProcessHeap(),0,lpszSubKeyW);
+ return ret;
+}
+
+
+/******************************************************************************
+ * RegNotifyChangeKeyValue [ADVAPI32.???]
+ */
+LONG WINAPI RegNotifyChangeKeyValue( HKEY hkey, BOOL32 fWatchSubTree,
+ DWORD fdwNotifyFilter, HANDLE32 hEvent,
+ BOOL32 fAsync )
+{
+ FIXME(reg,"(%x,%i,%ld,%d,%i): stub\n",hkey,fWatchSubTree,fdwNotifyFilter,
+ hEvent,fAsync);
+ return ERROR_SUCCESS;
+}
+
diff --git a/misc/shell.c b/misc/shell.c
index ecea14d..0520d69 100644
--- a/misc/shell.c
+++ b/misc/shell.c
@@ -794,9 +794,14 @@
_llseek32( hFile, 0, SEEK_SET );
if ( (_lread32(hFile,&mz_header,sizeof(mz_header)) != sizeof(mz_header)) ||
(mz_header.e_magic != IMAGE_DOS_SIGNATURE)
- )
- return 0;
-
+ ) { /* .ICO file ? */
+ if (mz_header.e_cblp == 1) { /* ICONHEADER.idType, must be 1 */
+ *retptr = (LPBYTE)-1;
+ return 1;
+ }
+ else
+ return 0; /* failed */
+ }
_llseek32( hFile, mz_header.e_lfanew, SEEK_SET );
if (_lread32( hFile, magic, sizeof(magic) ) != sizeof(magic))
return 0;
@@ -825,10 +830,9 @@
}
}
*retptr = pTypeInfo;
+ return IMAGE_OS2_SIGNATURE;
} else
- *retptr = (LPBYTE)-1;
- return IMAGE_OS2_SIGNATURE; /* handles .ICO too */
-
+ return 0; /* failed */
}
/*************************************************************************
@@ -945,7 +949,8 @@
sig = SHELL_GetResourceTable(hFile,&pData);
- if(sig == IMAGE_OS2_SIGNATURE)
+ if((sig == IMAGE_OS2_SIGNATURE)
+ || (sig == 1)) /* .ICO file */
{
HICON16 hIcon = 0;
NE_TYPEINFO* pTInfo = (NE_TYPEINFO*)(pData + 2);
diff --git a/misc/shellord.c b/misc/shellord.c
index a21ab8a..344ea11 100644
--- a/misc/shellord.c
+++ b/misc/shellord.c
@@ -521,7 +521,7 @@
strcpy(buf,"Desktop");
LoadString32A(hmod,id,buf2,100);
/* FIXME: the varargs handling doesn't. */
- FormatMessage32A(0x500,buf2,0,0,&buf3,256,&args);
+ FormatMessage32A(0x500,buf2,0,0,(LPSTR)&buf3,256,(LPDWORD)&args);
FIXME(shell,"(%08lx,%08lx,%08lx(%s),%08lx(%s),%08lx,%p):stub.\n",
(DWORD)hmod,(DWORD)hwnd,id,buf2,x,buf,type,arglist
@@ -660,3 +660,14 @@
return SHELL32_195(x);
}
+/*************************************************************************
+ * SHELL32_85 [SHELL32.85]
+ * unknown
+ */
+DWORD WINAPI SHELL32_85(DWORD x1,DWORD x2,DWORD x3,DWORD x4) {
+ FIXME(shell,"(0x%08lx,0x%08lx,0x%08lx,0x%08lx):stub.\n",
+ x1,x2,x3,x4
+ );
+ return 0;
+}
+
diff --git a/misc/spy.c b/misc/spy.c
index 2d5357c..979ad23 100644
--- a/misc/spy.c
+++ b/misc/spy.c
@@ -669,8 +669,11 @@
if (hTask == GetCurrentTask()) strcpy( taskName, "self" );
else if (!hTask) strcpy( taskName, "Wine" );
- else sprintf( taskName, "task %04x %s",
- hTask, MODULE_GetModuleName(hTask) );
+ else
+ {
+ sprintf( taskName, "task %04x ???", hTask );
+ GetModuleName( hTask, taskName + 10, sizeof(taskName) - 10 );
+ }
pname = SPY_GetWndName(hWnd);
if (iFlag == SPY_SENDMESSAGE16)
@@ -718,39 +721,39 @@
switch(iFlag)
{
case SPY_RESULT_DEFWND16:
- TRACE(message,"%*s(%04x) DefWindowProc16: %s [%04x] returned %08lx\n",
+ TRACE(message," %*s(%04x) DefWindowProc16: %s [%04x] returned %08lx\n",
SPY_IndentLevel, "", hWnd, SPY_GetMsgName( msg ), msg, lReturn );
break;
case SPY_RESULT_DEFWND32:
- TRACE(message,"%*s(%08x) DefWindowProc32: %s [%04x] returned %08lx\n",
+ TRACE(message," %*s(%08x) DefWindowProc32: %s [%04x] returned %08lx\n",
SPY_IndentLevel, "", hWnd, SPY_GetMsgName( msg ), msg, lReturn );
break;
case SPY_RESULT_OK16:
pname = SPY_GetWndName(hWnd);
- TRACE(message,"%*s(%04x) %-16s message [%04x] %s returned %08lx\n",
+ TRACE(message," %*s(%04x) %-16s message [%04x] %s returned %08lx\n",
SPY_IndentLevel, "", hWnd, pname, msg,
SPY_GetMsgName( msg ), lReturn );
break;
case SPY_RESULT_OK32:
pname = SPY_GetWndName(hWnd);
- TRACE(message,"%*s(%08x) %-16s message [%04x] %s returned %08lx\n",
+ TRACE(message," %*s(%08x) %-16s message [%04x] %s returned %08lx\n",
SPY_IndentLevel, "", hWnd, pname, msg,
SPY_GetMsgName( msg ), lReturn );
break;
case SPY_RESULT_INVALIDHWND16:
pname = SPY_GetWndName(hWnd);
- WARN(message, "%*s(%04x) %-16s message [%04x] %s HAS INVALID HWND\n",
+ WARN(message, " %*s(%04x) %-16s message [%04x] %s HAS INVALID HWND\n",
SPY_IndentLevel, "", hWnd, pname, msg,
SPY_GetMsgName( msg ) );
break;
case SPY_RESULT_INVALIDHWND32:
pname = SPY_GetWndName(hWnd);
- WARN(message, "%*s(%08x) %-16s message [%04x] %s HAS INVALID HWND\n",
+ WARN(message, " %*s(%08x) %-16s message [%04x] %s HAS INVALID HWND\n",
SPY_IndentLevel, "", hWnd, pname, msg,
SPY_GetMsgName( msg ) );
break;
diff --git a/misc/winsock.c b/misc/winsock.c
index 505adfd..24d5242 100644
--- a/misc/winsock.c
+++ b/misc/winsock.c
@@ -2581,11 +2581,10 @@
UINT16 wsaErrno(void)
{
int loc_errno = errno;
-#if defined(__FreeBSD__)
- ERR(winsock, "errno %d, (%s).\n",
- errno, strerror(errno));
+#ifdef HAVE_STRERROR
+ WARN(winsock, "errno %d, (%s).\n", errno, strerror(errno));
#else
- ERR(winsock, "errno %d\n", errno);
+ WARN(winsock, "errno %d\n", errno);
#endif
switch(loc_errno)
@@ -2657,11 +2656,10 @@
{
int loc_errno = h_errno;
-#if defined(__FreeBSD__)
- ERR(winsock, "h_errno %d, (%s).\n",
- h_errno, strerror(h_errno));
+#ifdef HAVE_STRERROR
+ WARN(winsock, "h_errno %d, (%s).\n", h_errno, strerror(h_errno));
#else
- ERR(winsock, "h_errno %d.\n", h_errno);
+ WARN(winsock, "h_errno %d.\n", h_errno);
#endif
switch(loc_errno)