wine/programs/regtest/regtest.c
Alexandre Julliard f90efa9cf0 Release 980614
Sun Jun 15 10:30:35 1998  Andreas Mohr <100.30936@germany.net>

	* [files/dos_fs.c] [files/file.c] [if1632/wprocs.spec]
	  [misc/aspi.c]
	Added support for scanners that need Adaptec's ASPI2DOS.

	* [graphics/env.c] [misc/printerdrv.c] [graphics/win16drv/init.c]
	  [if1632/gdi.spec] [include/gdi.h]
	Enhanced printer support (especially Win95):
	Drv[GS]etPrinterData, [GS]etEnvironment; added AbortProc handling.

	* [misc/tapi32.c] [relay32/tapi32.spec]
	Added some stubs.

	* [configure.in] [graphics/fontengine.c] [include/windows.h]
	  [misc/comm.c] [misc/w32skrnl.c] [misc/win32s16.c]
	Made Wine compile on HP-UX (just for fun ;)

	* [controls/menu.c] [include/windows.h]
	Complete rewrite of EnableMenuItem32.
	Free Agent 32 still doesn't work :(

	* [misc/version.c] [if1632/kernel.spec] [include/winbase.h]
	Implemented GetVersionEx16.

	* [misc/network.c] [if1632/user.spec]
	Fixed arguments of WNetGetPropertyText.

	* [misc/version.c] [relay32/comctl32.spec] [relay32/oleaut32.spec]
	Implemented COMCTL32_DllGetVersion, OaBuildVersion.

	* [win32/file.c]
	Fixed UNC handling of CreateFile32.

Sat Jun 13 22:35:12 1998  Douglas Ridgway  <ridgway@winehq.com>

	* [Makefile.in] [Make.rules.in]
	Added pattern for CVS merge files to 'make clean'

	* [ole/olecli.c] [windows/scroll.c] [windows/grahics.c]
	Add some DC handle unlocking. (When hdc's are always unlocked,
	they can be made moveable.)

	* [documentation/wine.texinfo] 
	Started a Wine Design chapter with discussion of 
	graphics driver model.

Sat Jun 13 11:19:25 1998  David Luyer <luyer@ucs.uwa.edu.au>

	* [misc/main.c] [relay32/relay386.c]
	Added new option -debugmsg +relay=.... or -debugmsg -relay=...

Fri Jun 12 22:56:09 1998  Marcus Meissner <marcus@jet.franken.de>

	* [relay32/snoop.c][relay32/builtin.c][loader/pe_image.c]
	Added inter win32 dll snooping. Use -debugmsg +snoop.
	Number of arguments and string references are autodetected.
	Some small bugfixes in the PE loader.

	* [misc/system.c]
	Disabled SystemTimers. They do not work with the current
	%fs handling in the 32->16 relaycode. (helps labview)

	* [msdos/dpmi.c][msdos/int2f.c][files/drive.c]
	Added a monoton linear increasing memory allocator for DPMI (required
	for LabView, HAFAS, ...)
	mscdex handling in emulated realmode interrupts (for mcicda.drv)
	allocate logical drives only once. (helps Myst)

	* [files/profile.c]
	Handle ^Z as space. Found on CDROMS (helps Myst Installer).

	* [multimedia/mmio.c]
	mmio* partially updated to win32. No funny additions.

	* [windows/driver.c]
	Added win32 driver handling (will be used for win32 multimedia/
	msvideo drivers).

	* [win32/device.c]
	Added device handling (K32OBJ_DEVICE_IOCTL). Implemented 
	VTDAPI.5 (used by win95' WINMM.timeGetTime())

Fri Jun 12 18:01:18 1998 Rein Klazes <rklazes@casema.net>

	* [ole/compobj.c relay32/ole32.spec]
	Add a stub for CoLockObjectExternal32.

	* [objects/clipping.c]
	Fix in IntersectClipRect(), when there is no initial clipping
	region.

	* [graphics/x11drv/graphics.c]
	Corrected several "one-off" errors for the Ellipse, Rectangle
	and RoundRectangle (especially small ones) draw routines. 
	Arc and friends still have to be done.

Fri Jun 12 06:23:19 1998  Matthew Becker <mbecker@glasscity.net>

	* [misc/ntdll.c]
	Fixed some of the parameter counts.

	* [misc/registry.c]
	General cleanup, documentation.
	Standard keys are allowed to be 'closed' and succeed.

	* [misc/shell.c]
	Check for correct return values from Reg* functions.

	* [win32/newfns.c]
	Added stubs for OpenDesktopA, SetThreadDesktop, and
	SetUserObjectInformationA.

Wed Jun 10  20:28:08 1998  James Juran  <jrj120@psu.edu>

	* [debugger/break.c]
	Fixed bug introduced in 980503 that broke the -debug command 
	line option for PE executable files.

	* [configure.in] [include/acconfig.h] [include/debugtools.h]
	  [documentation/debug-msgs]
	Added 'configure' options to compile out debugging messages.
	Use --disable-debug to disable all debugging messages, and
	--disable-trace to just disable TRACE messages.  This results
	in a stripped executable that is 15-20% smaller.  This option
	is very much untested--don't expect it to work.

	* [documentation/debug-msgs] [documentation/debugging]
	Minor updates.

	* [*/*.c]
	Fixed some compile warnings.  This also includes the
	compile_warnings_trivial patch from WineHQ.

Tue Jun 10 22:00:18 1998  Eric Kohl <ekohl@abo.rhein-zeitung.de>

	* [windows/sysmetrics.c][include/sysmetrics.h]
	Fixed some Win95 values.

	* [windows/nonclient.c][include/windows.h]
	Fixed some Win95 drawing bugs.
	Added extended window style flags (WS_EX_xxx).

	* [misc/printdrv.c][relay32/winspool.spec]
	Added stubs for DeletePrinterDriver32A, DeleteMonitor32A
	and DeletePort32A.

	* [windows/mdi.c][include/windows.h][relay32/user32.spec]
	Added stubs for CascadeWindows and TileWindows.

	* [controls/toolbar.c][include/toolbar.h]
	Fixed a few bugs and implemented new features.

	* [misc/shellord.c][relay32/shell32.spec]
	Added stubs for SHELL32_60, SHELL32_61 and SHELL32_184.

	* [controls/comctl32undoc.c][relay32/comctl32.spec]
	New file comctl32undoc.c. Contains undocumented functions
	of COMCTL32.DLL. These functions are needed to run EXPLORER.EXE
	IEXPLORE.EXE and TASKMAN.EXE.

	* [controls/status.c]
	Added text alignment.

Tue Jun  8 22:00:00 1998  Bertho Stultiens <bertho@akhphd.au.dk>

	* [programs/*/Makefile.in]
	Changed the rules to use wrc as resource compiler but
	passing the source through gcc first for macro expansion.

	* [programs/*/*.rc]
	Added #include "windows.h" for the resource compiler in the
	appropriate files.

	* [tools/wrc/wrc.[ch]] [tools/wrc/writeres.c]
	Added commandline option -A for autoregister code.
	Corrected the underscore problem by checking the proper define
	from config.h.

Sun Jun  7 22:09:29 1998  Pascal Cuoq <pcuoq@ens-lyon.fr>

	* [ole/ole2nls.c] [memory/string.c]
	Improved LCMapString32A, and changed CompareString32A,
	lstrcmp, lstrcmpi to use it.

Sat Jun  6 19:00:50 1998  Martin Strömberg <ams@ludd.luth.se>

	* [include/winnt.h]
	Added typedefs for security and tokens.

Sat Jun  6 12:26:31 1998  Morten Welinder  <terra@diku.dk>

	* [objects/text.c]
	Use debugstr_an in DrawText16.

	* [loader/resource.c]
	Use debugres_w in FindResourceEx32W.  Avoid crashing during
	debug when wm is NULL.

	* [if1632/relay.c]
	In RELAY_DebugCallTo16, send output to the right place and
	avoid side effects in macro arguments.

Wed Jun  3 20:56:03 1998  Huw D M Davies <daviesh@abacus.physics.ox.ac.uk>

	* [controls/scroll.c] [windows/nonclient.c]
	Fix several off by one errors in scrollbar painting.

Tue Jun  2 23:58:59 1998  Insomnia (Stea Greene) <insomnia@core.binghamton.edu>

	* [graphics/dsound.c]
	Rewrote mixer code to handle panning and volume for 16->16, 16->8,
	8->16, and 8->8 bit mixes.  Conforms to DirectX's "logarithmic
	hearing scale" as specified in M$VC docs.  Still does not handle
	mixing of different frequencies (I am still working on that). 
	Tested 16->16 extensively with StarCraft.  Other mixing combinations
	untested but should work fine.  Still kind of a work in progress,
	so be warned.

Tue Jun  2 03:31:33 1998  Alexander V. Lukyanov <lav@long.yar.ru>

	* [tools/wrc/utils.c]
	dup_basename: fix to strip directory.

Mon Jun  1 20:00:00 1998  Juergen Schmied <juergen.schmied@metronet.de>

	* [include/windows.h] [objects/cursoricon.c] [relay32/user32.spec]
	Added stubs LoadCursorFromFileW and LoadCursorFromFileA.
1998-06-14 15:24:15 +00:00

673 lines
20 KiB
C

/*
* Registry testing program
*
* Copyright 1998 Matthew Becker
*
* The return codes were generated in an NT40 environment, using lcc-win32
*
* NOTES
* When compiling under lcc-win32, I get three (3) warning, but they all
* seem to be issues with lcc.
*
* If creating a new testing sequence, please try to clean up any
* registry changes that are made.
*/
#include <stdio.h>
#include <malloc.h>
#include <windows.h>
#include <winreg.h>
#include <winerror.h>
#include <winnt.h>
/* True this when security is implemented */
#define CHECK_SAM FALSE
/*
* NOTES: These individual routines are listed in alphabetical order.
*
* They are meant to test error conditions. Success conditions are
* tested in the sequences found at the end.
*/
/******************************************************************************
* TestCloseKey
*/
void TestCloseKey()
{
long lSts;
fprintf(stderr, "Testing RegCloseKey...\n");
lSts = RegCloseKey((HKEY)2);
if (lSts != ERROR_INVALID_HANDLE) fprintf(stderr, " 1:%ld\n",lSts);
lSts = RegCloseKey(HKEY_LOCAL_MACHINE);
if (lSts != ERROR_SUCCESS) fprintf(stderr, " 2:%ld\n",lSts);
/* Check twice just for kicks */
lSts = RegCloseKey(HKEY_LOCAL_MACHINE);
if (lSts != ERROR_SUCCESS) fprintf(stderr, " 3:%ld\n",lSts);
}
/******************************************************************************
* TestConnectRegistry
*/
void TestConnectRegistry()
{
long lSts;
HKEY hkey;
fprintf(stderr, "Testing RegConnectRegistry...\n");
lSts = RegConnectRegistry("",(HKEY)2,&hkey);
if (lSts != ERROR_SUCCESS) fprintf(stderr, " 1:%ld\n",lSts);
lSts = RegConnectRegistry("",HKEY_LOCAL_MACHINE,&hkey);
if (lSts != ERROR_SUCCESS) fprintf(stderr, " 2:%ld\n",lSts);
#if TOO_SLOW
lSts = RegConnectRegistry("\\\\regtest",HKEY_LOCAL_MACHINE,&hkey);
if (lSts != ERROR_BAD_NETPATH) fprintf(stderr, " 3:%ld\n",lSts);
#endif
}
/******************************************************************************
* TestCreateKey
*/
void TestCreateKey()
{
long lSts;
HKEY hkey;
fprintf(stderr, "Testing RegCreateKey...\n");
lSts = RegCreateKey((HKEY)2,"",&hkey);
if (lSts != ERROR_BADKEY) fprintf(stderr, " 1:%ld\n",lSts);
lSts = RegCreateKey(HKEY_LOCAL_MACHINE,"",&hkey);
if (lSts != ERROR_SUCCESS) fprintf(stderr, " 2:%ld\n",lSts);
RegCloseKey(hkey);
lSts = RegCreateKey(HKEY_LOCAL_MACHINE,"\\asdf",&hkey);
if (lSts != ERROR_BAD_PATHNAME) fprintf(stderr, " 3:%ld\n",lSts);
#if 0
lSts = RegCreateKey(HKEY_LOCAL_MACHINE,"asdf\\",&hkey);
if (lSts != ERROR_INVALID_PARAMETER) fprintf(stderr, " 4:%ld\n",lSts);
#endif
lSts = RegCreateKey(HKEY_LOCAL_MACHINE,"\\asdf\\",&hkey);
if (lSts != ERROR_BAD_PATHNAME) fprintf(stderr, " 5:%ld\n",lSts);
}
/******************************************************************************
* TestCreateKeyEx
*/
void TestCreateKeyEx()
{
long lSts;
HKEY hkey;
DWORD dwDisp;
fprintf(stderr, "Testing RegCreateKeyEx...\n");
lSts = RegCreateKeyEx((HKEY)2,"",0,"",0,0,NULL,&hkey,&dwDisp);
if (lSts != ERROR_INVALID_HANDLE) fprintf(stderr, " 1:%ld\n",lSts);
lSts = RegCreateKeyEx(HKEY_LOCAL_MACHINE,"regtest",0,"",0,0,NULL,&hkey,
&dwDisp);
if (lSts != ERROR_INVALID_PARAMETER) fprintf(stderr, " 2:%ld\n",lSts);
lSts = RegCreateKeyEx(HKEY_LOCAL_MACHINE,"regtest",0,"asdf",0,
KEY_ALL_ACCESS,NULL,&hkey,&dwDisp);
if (lSts != ERROR_INVALID_PARAMETER) fprintf(stderr, " 3:%ld\n",lSts);
lSts = RegCreateKeyEx(HKEY_LOCAL_MACHINE,"regtest",0,"",0,
KEY_ALL_ACCESS,NULL,&hkey,&dwDisp);
if (lSts != ERROR_INVALID_PARAMETER) fprintf(stderr, " 4:%ld\n",lSts);
}
/******************************************************************************
* TestDeleteKey
*/
void TestDeleteKey()
{
long lSts;
fprintf(stderr, "Testing RegDeleteKey...\n");
lSts = RegDeleteKey((HKEY)2, "asdf");
if (lSts != ERROR_INVALID_HANDLE) fprintf(stderr, " 1:%ld\n",lSts);
lSts = RegDeleteKey(HKEY_CURRENT_USER, "asdf");
if (lSts != ERROR_FILE_NOT_FOUND) fprintf(stderr, " 2:%ld\n",lSts);
#if CHECK_SAM
lSts = RegDeleteKey(HKEY_CURRENT_USER, "");
if (lSts != ERROR_ACCESS_DENIED) fprintf(stderr, " 3:%ld\n",lSts);
#endif
}
/******************************************************************************
* TestDeleteValue
*/
void TestDeleteValue()
{
long lSts;
fprintf(stderr, "Testing RegDeleteValue...\n");
lSts = RegDeleteValue((HKEY)2, "asdf");
if (lSts != ERROR_INVALID_HANDLE) fprintf(stderr, " 1:%ld\n",lSts);
lSts = RegDeleteValue(HKEY_CURRENT_USER, "");
if (lSts != ERROR_FILE_NOT_FOUND) fprintf(stderr, " 2:%ld\n",lSts);
lSts = RegDeleteValue(HKEY_CURRENT_USER, "asdf");
if (lSts != ERROR_FILE_NOT_FOUND) fprintf(stderr, " 3:%ld\n",lSts);
lSts = RegDeleteValue(HKEY_CURRENT_USER, "\\asdf");
if (lSts != ERROR_FILE_NOT_FOUND) fprintf(stderr, " 4:%ld\n",lSts);
}
/******************************************************************************
* TestEnumKey
*/
void TestEnumKey()
{
long lSts;
char *sVal;
long lVal;
fprintf(stderr, "Testing RegEnumKey...\n");
lVal = 1;
sVal = (char *)malloc(lVal * sizeof(char));
lSts = RegEnumKey((HKEY)2,3,sVal,lVal);
if (lSts != ERROR_INVALID_HANDLE) fprintf(stderr, " 1:%ld\n",lSts);
lSts = RegEnumKey(HKEY_CURRENT_USER,-1,sVal,lVal);
if (lSts != ERROR_NO_MORE_ITEMS) fprintf(stderr, " 2:%ld\n",lSts);
lSts = RegEnumKey(HKEY_CURRENT_USER,0,sVal,lVal);
if (lSts != ERROR_MORE_DATA) fprintf(stderr, " 3:%ld\n",lSts);
}
/******************************************************************************
* TestEnumKeyEx
*/
void TestEnumKeyEx()
{
long lSts;
char *sVal;
char *sClass;
unsigned long lLen1;
unsigned long lLen2;
FILETIME ft;
fprintf(stderr, "Testing RegEnumKeyEx...\n");
lLen1 = 1;
sVal = (char *)malloc(lLen1 * sizeof(char));
lLen2 = 1;
sClass = (char *)malloc(lLen2 * sizeof(char));
lSts = RegEnumKeyEx((HKEY)2,0,sVal,&lLen1,0,sClass,&lLen2,&ft);
if (lSts != ERROR_INVALID_HANDLE) fprintf(stderr, " 1:%ld\n",lSts);
lSts = RegEnumKeyEx(HKEY_LOCAL_MACHINE,0,sVal,&lLen1,0,sClass,&lLen2,&ft);
if (lSts != ERROR_MORE_DATA) fprintf(stderr, " 2:%ld\n",lSts);
lSts = RegEnumKeyEx(HKEY_LOCAL_MACHINE,0,sVal,&lLen1,0,sClass,&lLen2,&ft);
if (lSts != ERROR_MORE_DATA) fprintf(stderr, " 3:%ld\n",lSts);
}
/******************************************************************************
* TestEnumValue
*/
void TestEnumValue()
{
long lSts;
char *sVal;
unsigned long lVal;
unsigned long lType;
unsigned long lLen1;
char *bVal;
fprintf(stderr, "Testing RegEnumValue...\n");
lVal = 1;
sVal = (char *)malloc(lVal * sizeof(char));
lLen1 = 1;
bVal = (char *)malloc(lLen1 * sizeof(char));
lSts = RegEnumValue((HKEY)2,-1,sVal,&lVal,0,&lType,NULL,&lLen1);
if (lSts != ERROR_INVALID_HANDLE) fprintf(stderr, " 1:%ld\n",lSts);
lSts = RegEnumValue(HKEY_LOCAL_MACHINE,-1,sVal,&lVal,0,&lType,NULL,&lLen1);
if (lSts != ERROR_NO_MORE_ITEMS) fprintf(stderr, " 2:%ld\n",lSts);
lSts = RegEnumValue(HKEY_LOCAL_MACHINE,0,sVal,&lVal,0,&lType,NULL,&lLen1);
if (lSts != ERROR_SUCCESS) fprintf(stderr, " 3:%ld\n",lSts);
lSts = RegEnumValue(HKEY_LOCAL_MACHINE,1,sVal,&lVal,0,&lType,bVal,&lLen1);
if (lSts != ERROR_NO_MORE_ITEMS) fprintf(stderr, " 4:%ld\n",lSts);
}
/******************************************************************************
* TestFlushKey
*/
void TestFlushKey()
{
long lSts;
fprintf(stderr, "Testing RegFlushKey...\n");
lSts = RegFlushKey((HKEY)2);
if (lSts != ERROR_INVALID_HANDLE) fprintf(stderr, " 1:%ld\n",lSts);
lSts = RegFlushKey(HKEY_LOCAL_MACHINE);
if (lSts != ERROR_SUCCESS) fprintf(stderr, " 2:%ld\n",lSts);
}
/******************************************************************************
* TestGetKeySecurity
*/
void TestGetKeySecurity()
{
long lSts;
SECURITY_INFORMATION si;
SECURITY_DESCRIPTOR sd;
unsigned long lLen;
fprintf(stderr, "Testing RegGetKeySecurity...\n");
lLen = sizeof(sd);
lSts = RegGetKeySecurity((HKEY)2,si,&sd,&lLen);
if (lSts != ERROR_INVALID_HANDLE) fprintf(stderr, " 1:%ld\n",lSts);
lSts = RegGetKeySecurity(HKEY_LOCAL_MACHINE,si,&sd,&lLen);
if (lSts != ERROR_INSUFFICIENT_BUFFER) fprintf(stderr, " 2:%ld\n",lSts);
si = GROUP_SECURITY_INFORMATION;
lSts = RegGetKeySecurity(HKEY_LOCAL_MACHINE,si,&sd,&lLen);
if (lSts != ERROR_SUCCESS) fprintf(stderr, " 3:%ld\n",lSts);
}
/******************************************************************************
* TestLoadKey
*/
void TestLoadKey()
{
long lSts;
fprintf(stderr, "Testing RegLoadKey...\n");
lSts = RegLoadKey((HKEY)2,"","");
if (lSts != ERROR_INVALID_PARAMETER) fprintf(stderr, " 1:%ld\n",lSts);
lSts = RegLoadKey(HKEY_CURRENT_USER,"","");
if (lSts != ERROR_INVALID_PARAMETER) fprintf(stderr, " 2:%ld\n",lSts);
lSts = RegLoadKey(HKEY_CURRENT_USER,"regtest","");
if (lSts != ERROR_INVALID_PARAMETER) fprintf(stderr, " 3:%ld\n",lSts);
lSts = RegLoadKey(HKEY_CURRENT_USER,"\\regtest","");
if (lSts != ERROR_INVALID_PARAMETER) fprintf(stderr, " 4:%ld\n",lSts);
#if CHECK_SAM
lSts = RegLoadKey(HKEY_CURRENT_USER,"regtest","regtest.dat");
if (lSts != ERROR_PRIVILEGE_NOT_HELD) fprintf(stderr, " 5:%ld\n",lSts);
lSts = RegLoadKey(HKEY_CURRENT_USER,"\\regtest","regtest.dat");
if (lSts != ERROR_PRIVILEGE_NOT_HELD) fprintf(stderr, " 6:%ld\n",lSts);
#endif
}
/******************************************************************************
* TestNotifyChangeKeyValue
*/
void TestNotifyChangeKeyValue()
{
long lSts;
HANDLE hEvent;
fprintf(stderr, "Testing RegNotifyChangeKeyValue...\n");
hEvent = (HANDLE)0;
lSts = RegNotifyChangeKeyValue((HKEY)2, TRUE, REG_NOTIFY_CHANGE_NAME, 0, 0);
if (lSts != ERROR_INVALID_HANDLE) fprintf(stderr, " 1:%ld\n",lSts);
lSts = RegNotifyChangeKeyValue(HKEY_CURRENT_USER, TRUE, REG_NOTIFY_CHANGE_NAME, 0, 1);
if (lSts != ERROR_INVALID_PARAMETER) fprintf(stderr, " 2:%ld\n",lSts);
hEvent = (HANDLE)HKEY_CURRENT_USER;
lSts = RegNotifyChangeKeyValue(HKEY_CURRENT_USER, TRUE, REG_NOTIFY_CHANGE_NAME, hEvent, 1);
if (lSts != ERROR_INVALID_HANDLE) fprintf(stderr, " 3:%ld\n",lSts);
}
/******************************************************************************
* TestOpenKey
*/
void TestOpenKey()
{
long lSts;
HKEY hkey;
fprintf(stderr, "Testing RegOpenKey...\n");
lSts = RegOpenKey((HKEY)72, "",&hkey);
if (lSts != ERROR_SUCCESS) fprintf(stderr, " 1:%ld\n",lSts);
RegCloseKey(hkey);
lSts = RegOpenKey((HKEY)2, "regtest",&hkey);
if (lSts != ERROR_INVALID_HANDLE) fprintf(stderr, " 2:%ld\n",lSts);
lSts = RegOpenKey(HKEY_CURRENT_USER, "regtest",&hkey);
if (lSts != ERROR_FILE_NOT_FOUND) fprintf(stderr, " 3:%ld\n",lSts);
lSts = RegOpenKey(HKEY_CURRENT_USER, "\\regtest",&hkey);
if (lSts != ERROR_BAD_PATHNAME) fprintf(stderr, " 4:%ld\n",lSts);
}
/******************************************************************************
* TestOpenKeyEx
*/
void TestOpenKeyEx()
{
long lSts;
HKEY hkey;
fprintf(stderr, "Testing RegOpenKeyEx...\n");
lSts = RegOpenKeyEx((HKEY)2,"",0,KEY_ALL_ACCESS,&hkey);
if (lSts != ERROR_INVALID_HANDLE) fprintf(stderr, " 1:%ld\n",lSts);
lSts = RegOpenKeyEx(HKEY_CURRENT_USER,"\\regtest",0,KEY_ALL_ACCESS,&hkey);
if (lSts != ERROR_BAD_PATHNAME) fprintf(stderr, " 2:%ld\n",lSts);
lSts = RegOpenKeyEx(HKEY_CURRENT_USER,"regtest",0,0,&hkey);
if (lSts != ERROR_FILE_NOT_FOUND) fprintf(stderr, " 3:%ld\n",lSts);
lSts = RegOpenKeyEx(HKEY_CURRENT_USER,"regtest\\",0,0,&hkey);
if (lSts != ERROR_FILE_NOT_FOUND) fprintf(stderr, " 3:%ld\n",lSts);
}
/******************************************************************************
* TestQueryInfoKey
*/
void TestQueryInfoKey()
{
long lSts;
char *sClass;
unsigned long lClass;
unsigned long lSubKeys;
unsigned long lMaxSubLen;
unsigned long lMaxClassLen;
unsigned long lValues;
unsigned long lMaxValNameLen;
unsigned long lMaxValLen;
unsigned long lSecDescLen;
FILETIME ft;
fprintf(stderr, "Testing RegQueryInfoKey...\n");
lClass = 1;
sClass = (char *)malloc(lClass * sizeof(char));
lSts = RegQueryInfoKey((HKEY)2,sClass,&lClass,0,&lSubKeys,&lMaxSubLen,
&lMaxClassLen,&lValues,&lMaxValNameLen,&lMaxValLen,
&lSecDescLen, &ft);
if (lSts != ERROR_INVALID_HANDLE) fprintf(stderr, " 1:%ld\n",lSts);
lSts = RegQueryInfoKey(HKEY_CURRENT_USER,sClass,&lClass,0,&lSubKeys,
&lMaxSubLen,&lMaxClassLen,&lValues,&lMaxValNameLen,
&lMaxValLen,&lSecDescLen, &ft);
if (lSts != ERROR_SUCCESS) fprintf(stderr, " 2:%ld\n",lSts);
}
/******************************************************************************
* TestQueryValue
*/
void TestQueryValue()
{
long lSts;
long lLen;
char *sVal;
fprintf(stderr, "Testing RegQueryValue...\n");
sVal = (char *)malloc(80 * sizeof(char));
lLen = strlen(sVal);
lSts = RegQueryValue((HKEY)2,"",NULL,&lLen);
if (lSts != ERROR_INVALID_HANDLE) fprintf(stderr, " 1:%ld\n",lSts);
lSts = RegQueryValue(HKEY_CURRENT_USER,"",NULL,&lLen);
if (lSts != ERROR_SUCCESS) fprintf(stderr, " 2:%ld\n",lSts);
lSts = RegQueryValue(HKEY_CURRENT_USER,"\\regtest",NULL,&lLen);
if (lSts != ERROR_BAD_PATHNAME) fprintf(stderr, " 3:%ld\n",lSts);
lSts = RegQueryValue(HKEY_CURRENT_USER,"",sVal,&lLen);
if (lSts != ERROR_SUCCESS) fprintf(stderr, " 4:%ld\n",lSts);
}
/******************************************************************************
* TestQueryValueEx
*/
void TestQueryValueEx()
{
char *sVal;
long lSts;
unsigned long lType;
unsigned long lLen;
fprintf(stderr, "Testing RegQueryValueEx...\n");
lLen = 80;
sVal = (char *)malloc(lLen * sizeof(char));
lSts = RegQueryValueEx((HKEY)2,"",0,&lType,sVal,&lLen);
if (lSts != ERROR_INVALID_HANDLE) fprintf(stderr, " 1:%ld\n",lSts);
lSts = RegQueryValueEx(HKEY_CURRENT_USER,"",(LPDWORD)1,&lType,sVal,&lLen);
if (lSts != ERROR_INVALID_PARAMETER) fprintf(stderr, " 2:%ld\n",lSts);
lSts = RegQueryValueEx(HKEY_LOCAL_MACHINE,"",0,&lType,sVal,&lLen);
if (lSts != ERROR_SUCCESS) fprintf(stderr, " 3:%ld\n",lSts);
}
/******************************************************************************
* TestReplaceKey
*/
void TestReplaceKey()
{
long lSts;
fprintf(stderr, "Testing RegReplaceKey...\n");
lSts = RegReplaceKey((HKEY)2,"","","");
if (lSts != ERROR_INVALID_HANDLE) fprintf(stderr, " 1:%ld\n",lSts);
#if CHECK_SAM
lSts = RegReplaceKey(HKEY_LOCAL_MACHINE,"","","");
if (lSts != ERROR_ACCESS_DENIED) fprintf(stderr, " 2:%ld\n",lSts);
lSts = RegReplaceKey(HKEY_LOCAL_MACHINE,"Software","","");
if (lSts != ERROR_ACCESS_DENIED) fprintf(stderr, " 3:%ld\n",lSts);
#endif
}
/******************************************************************************
* TestRestoreKey
*/
void TestRestoreKey()
{
long lSts;
fprintf(stderr, "Testing RegRestoreKey...\n");
lSts = RegRestoreKey((HKEY)2,"",0);
if (lSts != ERROR_INVALID_PARAMETER) fprintf(stderr, " 1:%ld\n",lSts);
lSts = RegRestoreKey(HKEY_LOCAL_MACHINE,"",0);
if (lSts != ERROR_INVALID_PARAMETER) fprintf(stderr, " 2:%ld\n",lSts);
lSts = RegRestoreKey(HKEY_LOCAL_MACHINE,"a.a",0);
if (lSts != ERROR_FILE_NOT_FOUND) fprintf(stderr, " 3:%ld\n",lSts);
}
/******************************************************************************
* TestSaveKey
*/
void TestSaveKey()
{
long lSts;
fprintf(stderr, "Testing RegSaveKey...\n");
lSts = RegSaveKey((HKEY)2,"",NULL);
if (lSts != ERROR_INVALID_PARAMETER) fprintf(stderr, " 1:%ld\n",lSts);
lSts = RegSaveKey(HKEY_LOCAL_MACHINE,"",NULL);
if (lSts != ERROR_INVALID_PARAMETER) fprintf(stderr, " 2:%ld\n",lSts);
#if CHECK_SAM
lSts = RegSaveKey(HKEY_LOCAL_MACHINE,"a.a",NULL);
if (lSts != ERROR_PRIVILEGE_NOT_HELD) fprintf(stderr, " 3:%ld\n",lSts);
#endif
}
/******************************************************************************
* TestSetKeySecurity
*/
void TestSetKeySecurity()
{
long lSts;
SECURITY_DESCRIPTOR sd;
fprintf(stderr, "Testing RegSetKeySecurity...\n");
lSts = RegSetKeySecurity((HKEY)2,0,NULL);
if (lSts != ERROR_INVALID_PARAMETER) fprintf(stderr, " 1:%ld\n",lSts);
lSts = RegSetKeySecurity(HKEY_LOCAL_MACHINE,0,NULL);
if (lSts != ERROR_INVALID_PARAMETER) fprintf(stderr, " 2:%ld\n",lSts);
lSts = RegSetKeySecurity(HKEY_LOCAL_MACHINE,OWNER_SECURITY_INFORMATION,NULL);
if (lSts != ERROR_INVALID_PARAMETER) fprintf(stderr, " 3:%ld\n",lSts);
lSts = RegSetKeySecurity(HKEY_LOCAL_MACHINE,OWNER_SECURITY_INFORMATION,&sd);
if (lSts != ERROR_INVALID_PARAMETER) fprintf(stderr, " 4:%ld\n",lSts);
}
/******************************************************************************
* TestSetValue
*/
void TestSetValue()
{
long lSts;
fprintf(stderr, "Testing RegSetValue...\n");
#if MAKE_NT_CRASH
lSts = RegSetValue((HKEY)2,"",0,NULL,0);
if (lSts != ERROR_INVALID_PARAMETER) fprintf(stderr, " 1:%ld\n",lSts);
#endif
#if MAKE_NT_CRASH
lSts = RegSetValue((HKEY)2,"regtest",0,NULL,0);
if (lSts != ERROR_INVALID_PARAMETER) fprintf(stderr, " 2:%ld\n",lSts);
#endif
#if MAKE_NT_CRASH
lSts = RegSetValue((HKEY)2,"regtest",REG_SZ,NULL,0);
if (lSts != ERROR_INVALID_HANDLE) fprintf(stderr, " 3:%ld\n",lSts);
#endif
#if MAKE_NT_CRASH
lSts = RegSetValue(HKEY_LOCAL_MACHINE,"regtest",REG_SZ,NULL,0);
if (lSts != ERROR_INVALID_HANDLE) fprintf(stderr, " 4:%ld\n",lSts);
#endif
}
/******************************************************************************
* TestSetValueEx
*/
void TestSetValueEx()
{
long lSts;
fprintf(stderr, "Testing RegSetValueEx...\n");
lSts = RegSetValueEx((HKEY)2,"",0,0,NULL,0);
if (lSts != ERROR_INVALID_HANDLE) fprintf(stderr, " 1:%ld\n",lSts);
lSts = RegSetValueEx(HKEY_LOCAL_MACHINE,"",0,0,NULL,0);
if (lSts != ERROR_SUCCESS) fprintf(stderr, " 2:%ld\n",lSts);
}
/******************************************************************************
* TestUnLoadKey
*/
void TestUnLoadKey()
{
long lSts;
fprintf(stderr, "Testing RegUnloadKey...\n");
#if CHECK_SAM
lSts = RegUnLoadKey((HKEY)2,"");
if (lSts != ERROR_PRIVILEGE_NOT_HELD) fprintf(stderr, " 1:%ld\n",lSts);
lSts = RegUnLoadKey(HKEY_LOCAL_MACHINE,"");
if (lSts != ERROR_PRIVILEGE_NOT_HELD) fprintf(stderr, " 2:%ld\n",lSts);
lSts = RegUnLoadKey(HKEY_LOCAL_MACHINE,"\\regtest");
if (lSts != ERROR_PRIVILEGE_NOT_HELD) fprintf(stderr, " 3:%ld\n",lSts);
#endif
}
/******************************************************************************
* TestSequence1
*/
void TestSequence1()
{
HKEY hkey;
long lSts;
fprintf(stderr, "Testing Sequence1...\n");
lSts = RegCreateKey(HKEY_CURRENT_USER,"regtest",&hkey);
if (lSts != ERROR_SUCCESS) fprintf(stderr, " 1:%ld\n",lSts);
fprintf(stderr, " hkey=0x%x\n", hkey);
lSts = RegDeleteKey(HKEY_CURRENT_USER, "regtest");
if (lSts != ERROR_SUCCESS) fprintf(stderr, " 2:%ld\n",lSts);
lSts = RegCloseKey(hkey);
if (lSts != ERROR_SUCCESS) fprintf(stderr, " 3:%ld\n",lSts);
}
int PASCAL WinMain (HANDLE inst, HANDLE prev, LPSTR cmdline, int show)
{
/* These can be in any order */
TestCloseKey();
TestConnectRegistry();
TestCreateKey();
TestCreateKeyEx();
TestDeleteKey();
TestDeleteValue();
TestEnumKey();
TestEnumKeyEx();
TestEnumValue();
TestFlushKey();
TestGetKeySecurity();
TestLoadKey();
TestNotifyChangeKeyValue();
TestOpenKey();
TestOpenKeyEx();
TestQueryInfoKey();
TestQueryValue();
TestQueryValueEx();
TestReplaceKey();
TestRestoreKey();
TestSaveKey();
TestSetKeySecurity();
TestSetValue();
TestSetValueEx();
TestUnLoadKey();
/* Now we have some sequence testing */
TestSequence1();
return 0;
}