Remove irrelevant (and incomplete) documentation in 'The Wine DocBook
[wine/testsucceed.git] / programs / regtest / regtest.c
blobd112208e2c3a277141c849f87927e3bdeeb33748
1 /*
2 * Registry testing program
4 * Copyright 1998 Matthew Becker
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 * The return codes were generated in an NT40 environment, using lcc-win32
22 * NOTES
23 * When compiling under lcc-win32, I get three (3) warning, but they all
24 * seem to be issues with lcc.
26 * If creating a new testing sequence, please try to clean up any
27 * registry changes that are made.
30 #include <stdio.h>
31 #include <stdlib.h>
32 #include <windows.h>
33 #include <winreg.h>
34 #include <winerror.h>
35 #include <winnt.h>
37 #ifndef __GNUC__
38 #define __FUNCTION__ "<function>"
39 #endif
41 /* True this when security is implemented */
42 #define CHECK_SAM FALSE
44 #define xERROR(s,d) fprintf(stderr, "%s:#%d(Status=%ld)\n", __FUNCTION__,s,d)
47 * NOTES: These individual routines are listed in alphabetical order.
49 * They are meant to test error conditions. Success conditions are
50 * tested in the sequences found at the end.
53 /******************************************************************************
54 * TestCloseKey
56 void TestCloseKey()
58 long lSts;
60 lSts = RegCloseKey((HKEY)2);
61 if (lSts != ERROR_INVALID_HANDLE) xERROR(1,lSts);
63 lSts = RegCloseKey(HKEY_LOCAL_MACHINE);
64 if (lSts != ERROR_SUCCESS) xERROR(2,lSts);
66 /* Check twice just for kicks */
67 lSts = RegCloseKey(HKEY_LOCAL_MACHINE);
68 if (lSts != ERROR_SUCCESS) xERROR(3,lSts);
71 /******************************************************************************
72 * TestConnectRegistry
74 void TestConnectRegistry()
76 long lSts;
77 HKEY hkey;
79 lSts = RegConnectRegistry("",(HKEY)2,&hkey);
80 if (lSts != ERROR_SUCCESS) xERROR(1,lSts);
82 lSts = RegConnectRegistry("",HKEY_LOCAL_MACHINE,&hkey);
83 if (lSts != ERROR_SUCCESS) xERROR(2,lSts);
85 #if TOO_SLOW
86 lSts = RegConnectRegistry("\\\\regtest",HKEY_LOCAL_MACHINE,&hkey);
87 if (lSts != ERROR_BAD_NETPATH) xERROR(3,lSts);
88 #endif
91 /******************************************************************************
92 * TestCreateKey
94 void TestCreateKey()
96 long lSts;
97 HKEY hkey;
99 lSts = RegCreateKey((HKEY)2,"",&hkey);
100 if (lSts != ERROR_BADKEY) xERROR(1,lSts);
102 lSts = RegCreateKey(HKEY_LOCAL_MACHINE,"",&hkey);
103 if (lSts != ERROR_SUCCESS) xERROR(2,lSts);
104 RegCloseKey(hkey);
106 lSts = RegCreateKey(HKEY_LOCAL_MACHINE,"\\asdf",&hkey);
107 if (lSts != ERROR_BAD_PATHNAME) xERROR(3,lSts);
109 #if 0
110 lSts = RegCreateKey(HKEY_LOCAL_MACHINE,"asdf\\",&hkey);
111 if (lSts != ERROR_INVALID_PARAMETER) xERROR(4,lSts);
112 #endif
114 lSts = RegCreateKey(HKEY_LOCAL_MACHINE,"\\asdf\\",&hkey);
115 if (lSts != ERROR_BAD_PATHNAME) xERROR(5,lSts);
118 /******************************************************************************
119 * TestCreateKeyEx
121 void TestCreateKeyEx()
123 long lSts;
124 HKEY hkey;
125 DWORD dwDisp;
127 lSts = RegCreateKeyEx((HKEY)2,"",0,"",0,0,NULL,&hkey,&dwDisp);
128 if (lSts != ERROR_INVALID_HANDLE) xERROR(1,lSts);
130 lSts = RegCreateKeyEx(HKEY_LOCAL_MACHINE,"regtest",0,"",0,0,NULL,&hkey,
131 &dwDisp);
132 if (lSts != ERROR_INVALID_PARAMETER) xERROR(2,lSts);
134 lSts = RegCreateKeyEx(HKEY_LOCAL_MACHINE,"regtest",0,"asdf",0,
135 KEY_ALL_ACCESS,NULL,&hkey,&dwDisp);
136 if (lSts != ERROR_INVALID_PARAMETER) xERROR(3,lSts);
138 lSts = RegCreateKeyEx(HKEY_LOCAL_MACHINE,"regtest",0,"",0,
139 KEY_ALL_ACCESS,NULL,&hkey,&dwDisp);
140 if (lSts != ERROR_INVALID_PARAMETER) xERROR(4,lSts);
144 /******************************************************************************
145 * TestCreateKeyEx
147 void TestCreateKeyEx1()
149 long lSts;
150 HKEY hkey,hkeyP;
151 DWORD dwDisp;
152 char keyname[]="regtest1";
154 lSts = RegOpenKeyEx(HKEY_LOCAL_MACHINE,"SOFTWARE",0,1,&hkeyP);
155 if (lSts != ERROR_SUCCESS)
157 xERROR(1,lSts);
158 return;
160 lSts = RegCreateKeyEx(hkeyP,keyname,0,0,0,0xf003f,0,&hkey,&dwDisp);
161 if (lSts != ERROR_SUCCESS)
163 xERROR(2,lSts);
164 RegCloseKey(hkeyP);
165 return;
167 lSts = RegDeleteKey( hkeyP,keyname);
168 if (lSts != ERROR_SUCCESS) xERROR(3,lSts);
169 RegCloseKey(hkeyP);
172 /******************************************************************************
173 * TestDeleteKey
175 void TestDeleteKey()
177 long lSts;
179 lSts = RegDeleteKey((HKEY)2, "asdf");
180 if (lSts != ERROR_INVALID_HANDLE) xERROR(1,lSts);
182 lSts = RegDeleteKey(HKEY_CURRENT_USER, "asdf");
183 if (lSts != ERROR_FILE_NOT_FOUND) xERROR(2,lSts);
185 #if CHECK_SAM
186 lSts = RegDeleteKey(HKEY_CURRENT_USER, "");
187 if (lSts != ERROR_ACCESS_DENIED) xERROR(3,lSts);
188 #endif
191 /******************************************************************************
192 * TestDeleteValue
194 void TestDeleteValue()
196 long lSts;
198 lSts = RegDeleteValue((HKEY)2, "asdf");
199 if (lSts != ERROR_INVALID_HANDLE) xERROR(1,lSts);
201 lSts = RegDeleteValue(HKEY_CURRENT_USER, "");
202 if (lSts != ERROR_FILE_NOT_FOUND) xERROR(2,lSts);
204 lSts = RegDeleteValue(HKEY_CURRENT_USER, "asdf");
205 if (lSts != ERROR_FILE_NOT_FOUND) xERROR(3,lSts);
207 lSts = RegDeleteValue(HKEY_CURRENT_USER, "\\asdf");
208 if (lSts != ERROR_FILE_NOT_FOUND) xERROR(4,lSts);
211 /******************************************************************************
212 * TestEnumKey
214 void TestEnumKey()
216 long lSts;
217 char *sVal;
218 long lVal;
220 lVal = 1;
221 sVal = (char *)malloc(lVal * sizeof(char));
223 lSts = RegEnumKey((HKEY)2,3,sVal,lVal);
224 if (lSts != ERROR_INVALID_HANDLE) xERROR(1,lSts);
226 lSts = RegEnumKey(HKEY_CURRENT_USER,-1,sVal,lVal);
227 if (lSts != ERROR_NO_MORE_ITEMS) xERROR(2,lSts);
229 lSts = RegEnumKey(HKEY_CURRENT_USER,0,sVal,lVal);
230 if (lSts != ERROR_MORE_DATA) xERROR(3,lSts);
232 free(sVal);
235 /******************************************************************************
236 * TestEnumKeyEx
238 void TestEnumKeyEx()
240 long lSts;
241 char *sVal;
242 char *sClass;
243 unsigned long lLen1;
244 unsigned long lLen2;
245 FILETIME ft;
247 lLen1 = 1;
248 sVal = (char *)malloc(lLen1 * sizeof(char));
249 lLen2 = 1;
250 sClass = (char *)malloc(lLen2 * sizeof(char));
252 lSts = RegEnumKeyEx((HKEY)2,0,sVal,&lLen1,0,sClass,&lLen2,&ft);
253 if (lSts != ERROR_INVALID_HANDLE) xERROR(1,lSts);
255 lSts = RegEnumKeyEx(HKEY_LOCAL_MACHINE,0,sVal,&lLen1,0,sClass,&lLen2,&ft);
256 if (lSts != ERROR_MORE_DATA) xERROR(2,lSts);
258 lSts = RegEnumKeyEx(HKEY_LOCAL_MACHINE,0,sVal,&lLen1,0,sClass,&lLen2,&ft);
259 if (lSts != ERROR_MORE_DATA) xERROR(3,lSts);
261 free(sVal);
262 free(sClass);
265 /******************************************************************************
266 * TestEnumValue
268 void TestEnumValue()
270 long lSts;
271 char *sVal;
272 unsigned long lVal;
273 unsigned long lType;
274 unsigned long lLen1;
275 char *bVal;
277 lVal = 1;
278 sVal = (char *)malloc(lVal * sizeof(char));
279 lLen1 = 1;
280 bVal = (char *)malloc(lLen1 * sizeof(char));
282 lSts = RegEnumValue((HKEY)2,-1,sVal,&lVal,0,&lType,NULL,&lLen1);
283 if (lSts != ERROR_INVALID_HANDLE) xERROR(1,lSts);
285 lSts = RegEnumValue(HKEY_LOCAL_MACHINE,-1,sVal,&lVal,0,&lType,NULL,&lLen1);
286 if (lSts != ERROR_NO_MORE_ITEMS) xERROR(2,lSts);
288 lSts = RegEnumValue(HKEY_LOCAL_MACHINE,0,sVal,&lVal,0,&lType,NULL,&lLen1);
289 if (lSts != ERROR_SUCCESS) xERROR(3,lSts);
291 lSts = RegEnumValue(HKEY_LOCAL_MACHINE,0,sVal,&lVal,0,NULL,NULL,&lLen1);
292 if (lSts != ERROR_SUCCESS) xERROR(4,lSts);
294 lSts = RegEnumValue(HKEY_LOCAL_MACHINE,1,sVal,&lVal,0,&lType,bVal,&lLen1);
295 if (lSts != ERROR_NO_MORE_ITEMS) xERROR(5,lSts);
297 free(sVal);
298 free(bVal);
301 /******************************************************************************
302 * TestFlushKey
304 void TestFlushKey()
306 long lSts;
308 lSts = RegFlushKey((HKEY)2);
309 if (lSts != ERROR_INVALID_HANDLE) xERROR(1,lSts);
311 lSts = RegFlushKey(HKEY_LOCAL_MACHINE);
312 if (lSts != ERROR_SUCCESS) xERROR(2,lSts);
315 /******************************************************************************
316 * TestGetKeySecurity
318 void TestGetKeySecurity()
320 long lSts;
321 SECURITY_INFORMATION si;
322 SECURITY_DESCRIPTOR sd;
323 unsigned long lLen;
325 lLen = sizeof(sd);
326 si = 0;
327 lSts = RegGetKeySecurity((HKEY)2,si,&sd,&lLen);
328 if (lSts != ERROR_INVALID_HANDLE) xERROR(1,lSts);
330 lSts = RegGetKeySecurity(HKEY_LOCAL_MACHINE,si,&sd,&lLen);
331 if (lSts != ERROR_INSUFFICIENT_BUFFER) xERROR(2,lSts);
333 si = GROUP_SECURITY_INFORMATION;
334 lSts = RegGetKeySecurity(HKEY_LOCAL_MACHINE,si,&sd,&lLen);
335 if (lSts != ERROR_SUCCESS) xERROR(3,lSts);
338 /******************************************************************************
339 * TestLoadKey
341 void TestLoadKey()
343 long lSts;
345 lSts = RegLoadKey((HKEY)2,"","");
346 if (lSts != ERROR_INVALID_PARAMETER) xERROR(1,lSts);
348 lSts = RegLoadKey(HKEY_CURRENT_USER,"","");
349 if (lSts != ERROR_INVALID_PARAMETER) xERROR(2,lSts);
351 lSts = RegLoadKey(HKEY_CURRENT_USER,"regtest","");
352 if (lSts != ERROR_INVALID_PARAMETER) xERROR(3,lSts);
354 lSts = RegLoadKey(HKEY_CURRENT_USER,"\\regtest","");
355 if (lSts != ERROR_INVALID_PARAMETER) xERROR(4,lSts);
357 #if CHECK_SAM
358 lSts = RegLoadKey(HKEY_CURRENT_USER,"regtest","regtest.dat");
359 if (lSts != ERROR_PRIVILEGE_NOT_HELD) xERROR(5,lSts);
361 lSts = RegLoadKey(HKEY_CURRENT_USER,"\\regtest","regtest.dat");
362 if (lSts != ERROR_PRIVILEGE_NOT_HELD) xERROR(6,lSts);
363 #endif
366 /******************************************************************************
367 * TestNotifyChangeKeyValue
369 void TestNotifyChangeKeyValue()
371 long lSts;
372 HANDLE hEvent;
374 hEvent = 0;
376 lSts = RegNotifyChangeKeyValue((HKEY)2, TRUE, REG_NOTIFY_CHANGE_NAME, 0, 0);
377 if (lSts != ERROR_INVALID_HANDLE) xERROR(1,lSts);
379 lSts = RegNotifyChangeKeyValue(HKEY_CURRENT_USER, TRUE, REG_NOTIFY_CHANGE_NAME, 0, 1);
380 if (lSts != ERROR_INVALID_PARAMETER) xERROR(2,lSts);
382 hEvent = (HANDLE)HKEY_CURRENT_USER;
383 lSts = RegNotifyChangeKeyValue(HKEY_CURRENT_USER, TRUE, REG_NOTIFY_CHANGE_NAME, hEvent, 1);
384 if (lSts != ERROR_INVALID_HANDLE) xERROR(3,lSts);
387 /******************************************************************************
388 * TestOpenKey
390 void TestOpenKey()
392 long lSts;
393 HKEY hkey;
395 lSts = RegOpenKey((HKEY)72, "",&hkey);
396 if (lSts != ERROR_SUCCESS) xERROR(1,lSts);
397 RegCloseKey(hkey);
399 lSts = RegOpenKey((HKEY)2, "regtest",&hkey);
400 if (lSts != ERROR_INVALID_HANDLE) xERROR(2,lSts);
402 lSts = RegOpenKey(HKEY_CURRENT_USER, "regtest",&hkey);
403 if (lSts != ERROR_FILE_NOT_FOUND) xERROR(3,lSts);
405 lSts = RegOpenKey(HKEY_CURRENT_USER, "\\regtest",&hkey);
406 if (lSts != ERROR_BAD_PATHNAME) xERROR(4,lSts);
409 /******************************************************************************
410 * TestOpenKeyEx
412 void TestOpenKeyEx()
414 long lSts;
415 HKEY hkey;
417 lSts = RegOpenKeyEx((HKEY)2,"",0,KEY_ALL_ACCESS,&hkey);
418 if (lSts != ERROR_INVALID_HANDLE) xERROR(1,lSts);
420 lSts = RegOpenKeyEx(HKEY_CURRENT_USER,"\\regtest",0,KEY_ALL_ACCESS,&hkey);
421 if (lSts != ERROR_BAD_PATHNAME) xERROR(2,lSts);
423 lSts = RegOpenKeyEx(HKEY_CURRENT_USER,"regtest",0,0,&hkey);
424 if (lSts != ERROR_FILE_NOT_FOUND) xERROR(3,lSts);
426 lSts = RegOpenKeyEx(HKEY_CURRENT_USER,"regtest\\",0,0,&hkey);
427 if (lSts != ERROR_FILE_NOT_FOUND) xERROR(4,lSts);
430 /******************************************************************************
431 * TestQueryInfoKey
433 void TestQueryInfoKey()
435 long lSts;
436 char *sClass;
437 unsigned long lClass;
438 unsigned long lSubKeys;
439 unsigned long lMaxSubLen;
440 unsigned long lMaxClassLen;
441 unsigned long lValues;
442 unsigned long lMaxValNameLen;
443 unsigned long lMaxValLen;
444 unsigned long lSecDescLen;
445 FILETIME ft;
447 lClass = 1;
448 sClass = (char *)malloc(lClass * sizeof(char));
450 lSts = RegQueryInfoKey((HKEY)2,sClass,&lClass,0,&lSubKeys,&lMaxSubLen,
451 &lMaxClassLen,&lValues,&lMaxValNameLen,&lMaxValLen,
452 &lSecDescLen, &ft);
453 if (lSts != ERROR_INVALID_HANDLE) xERROR(1,lSts);
455 lSts = RegQueryInfoKey(HKEY_CURRENT_USER,sClass,&lClass,0,&lSubKeys,
456 &lMaxSubLen,&lMaxClassLen,&lValues,&lMaxValNameLen,
457 &lMaxValLen,&lSecDescLen, &ft);
458 if (lSts != ERROR_SUCCESS) xERROR(2,lSts);
460 free(sClass);
463 /******************************************************************************
464 * TestQueryValue
466 void TestQueryValue()
468 long lSts;
469 long lLen;
470 char *sVal;
472 sVal = (char *)malloc(80 * sizeof(char));
473 lLen = strlen(sVal);
475 lSts = RegQueryValue((HKEY)2,"",NULL,&lLen);
476 if (lSts != ERROR_INVALID_HANDLE) xERROR(1,lSts);
478 lSts = RegQueryValue(HKEY_CURRENT_USER,"",NULL,&lLen);
479 if (lSts != ERROR_SUCCESS) xERROR(2,lSts);
481 lSts = RegQueryValue(HKEY_CURRENT_USER,"\\regtest",NULL,&lLen);
482 if (lSts != ERROR_BAD_PATHNAME) xERROR(3,lSts);
484 lSts = RegQueryValue(HKEY_CURRENT_USER,"",sVal,&lLen);
485 if (lSts != ERROR_SUCCESS) xERROR(4,lSts);
487 free(sVal);
490 /******************************************************************************
491 * TestQueryValueEx
493 void TestQueryValueEx()
495 char *sVal;
496 long lSts;
497 unsigned long lType;
498 unsigned long lLen;
500 lLen = 80;
501 sVal = (char *)malloc(lLen * sizeof(char));
503 lSts = RegQueryValueEx((HKEY)2,"",0,&lType,sVal,&lLen);
504 if (lSts != ERROR_INVALID_HANDLE) xERROR(1,lSts);
506 lSts = RegQueryValueEx(HKEY_CURRENT_USER,"",(LPDWORD)1,&lType,sVal,&lLen);
507 if (lSts != ERROR_INVALID_PARAMETER) xERROR(2,lSts);
509 lSts = RegQueryValueEx(HKEY_LOCAL_MACHINE,"",0,&lType,sVal,&lLen);
510 if (lSts != ERROR_SUCCESS) xERROR(3,lSts);
512 free(sVal);
515 /******************************************************************************
516 * TestReplaceKey
518 void TestReplaceKey()
520 long lSts;
522 lSts = RegReplaceKey((HKEY)2,"","","");
523 if (lSts != ERROR_INVALID_HANDLE) xERROR(1,lSts);
525 #if CHECK_SAM
526 lSts = RegReplaceKey(HKEY_LOCAL_MACHINE,"","","");
527 if (lSts != ERROR_ACCESS_DENIED) xERROR(2,lSts);
529 lSts = RegReplaceKey(HKEY_LOCAL_MACHINE,"Software","","");
530 if (lSts != ERROR_ACCESS_DENIED) xERROR(3,lSts);
531 #endif
534 /******************************************************************************
535 * TestRestoreKey
537 void TestRestoreKey()
539 long lSts;
541 lSts = RegRestoreKey((HKEY)2,"",0);
542 if (lSts != ERROR_INVALID_PARAMETER) xERROR(1,lSts);
544 lSts = RegRestoreKey(HKEY_LOCAL_MACHINE,"",0);
545 if (lSts != ERROR_INVALID_PARAMETER) xERROR(2,lSts);
547 lSts = RegRestoreKey(HKEY_LOCAL_MACHINE,"a.a",0);
548 if (lSts != ERROR_FILE_NOT_FOUND) xERROR(3,lSts);
551 /******************************************************************************
552 * TestSaveKey
554 void TestSaveKey()
556 long lSts;
558 lSts = RegSaveKey((HKEY)2,"",NULL);
559 if (lSts != ERROR_INVALID_PARAMETER) xERROR(1,lSts);
561 lSts = RegSaveKey(HKEY_LOCAL_MACHINE,"",NULL);
562 if (lSts != ERROR_INVALID_PARAMETER) xERROR(2,lSts);
564 #if CHECK_SAM
565 lSts = RegSaveKey(HKEY_LOCAL_MACHINE,"a.a",NULL);
566 if (lSts != ERROR_PRIVILEGE_NOT_HELD) xERROR(3,lSts);
567 #endif
570 /******************************************************************************
571 * TestSetKeySecurity
573 void TestSetKeySecurity()
575 long lSts;
576 SECURITY_DESCRIPTOR sd;
578 lSts = RegSetKeySecurity((HKEY)2,0,NULL);
579 if (lSts != ERROR_INVALID_PARAMETER) xERROR(1,lSts);
581 lSts = RegSetKeySecurity(HKEY_LOCAL_MACHINE,0,NULL);
582 if (lSts != ERROR_INVALID_PARAMETER) xERROR(2,lSts);
584 lSts = RegSetKeySecurity(HKEY_LOCAL_MACHINE,OWNER_SECURITY_INFORMATION,NULL);
585 if (lSts != ERROR_INVALID_PARAMETER) xERROR(3,lSts);
587 lSts = RegSetKeySecurity(HKEY_LOCAL_MACHINE,OWNER_SECURITY_INFORMATION,&sd);
588 if (lSts != ERROR_INVALID_PARAMETER) xERROR(4,lSts);
591 /******************************************************************************
592 * TestSetValue
594 void TestSetValue()
596 #if MAKE_NT_CRASH
597 long lSts;
598 #endif
600 #if MAKE_NT_CRASH
601 lSts = RegSetValue((HKEY)2,"",0,NULL,0);
602 if (lSts != ERROR_INVALID_PARAMETER) xERROR(1,lSts);
603 #endif
605 #if MAKE_NT_CRASH
606 lSts = RegSetValue((HKEY)2,"regtest",0,NULL,0);
607 if (lSts != ERROR_INVALID_PARAMETER) xERROR(2,lSts);
608 #endif
610 #if MAKE_NT_CRASH
611 lSts = RegSetValue((HKEY)2,"regtest",REG_SZ,NULL,0);
612 if (lSts != ERROR_INVALID_HANDLE) xERROR(3,lSts);
613 #endif
615 #if MAKE_NT_CRASH
616 lSts = RegSetValue(HKEY_LOCAL_MACHINE,"regtest",REG_SZ,NULL,0);
617 if (lSts != ERROR_INVALID_HANDLE) xERROR(4,lSts);
618 #endif
621 /******************************************************************************
622 * TestSetValueEx
624 void TestSetValueEx()
626 long lSts;
628 lSts = RegSetValueEx((HKEY)2,"",0,0,NULL,0);
629 if (lSts != ERROR_INVALID_HANDLE) xERROR(1,lSts);
631 lSts = RegSetValueEx(HKEY_LOCAL_MACHINE,"",0,0,NULL,0);
632 if (lSts != ERROR_SUCCESS) xERROR(2,lSts);
635 /******************************************************************************
636 * TestUnLoadKey
638 void TestUnLoadKey()
640 #if CHECK_SAM
641 long lSts;
642 #endif
644 #if CHECK_SAM
645 lSts = RegUnLoadKey((HKEY)2,"");
646 if (lSts != ERROR_PRIVILEGE_NOT_HELD) xERROR(1,lSts);
648 lSts = RegUnLoadKey(HKEY_LOCAL_MACHINE,"");
649 if (lSts != ERROR_PRIVILEGE_NOT_HELD) xERROR(2,lSts);
651 lSts = RegUnLoadKey(HKEY_LOCAL_MACHINE,"\\regtest");
652 if (lSts != ERROR_PRIVILEGE_NOT_HELD) xERROR(3,lSts);
653 #endif
656 /******************************************************************************
657 * TestSequence1
659 void TestSequence1()
661 HKEY hkey;
662 long lSts;
664 lSts = RegCreateKey(HKEY_CURRENT_USER,"regtest",&hkey);
665 if (lSts != ERROR_SUCCESS) xERROR(1,lSts);
667 /* fprintf(stderr, " hkey=0x%x\n", hkey); */
669 lSts = RegDeleteKey(HKEY_CURRENT_USER, "regtest");
670 if (lSts != ERROR_SUCCESS) xERROR(2,lSts);
671 lSts = RegCloseKey(hkey);
672 if (lSts != ERROR_SUCCESS) xERROR(3,lSts);
676 int PASCAL WinMain (HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
679 /* These can be in any order */
680 TestCloseKey();
681 TestConnectRegistry();
682 TestCreateKey();
683 TestCreateKeyEx();
684 TestDeleteKey();
685 TestDeleteValue();
686 TestEnumKey();
687 TestEnumKeyEx();
688 TestEnumValue();
689 TestFlushKey();
690 TestGetKeySecurity();
691 TestLoadKey();
692 TestNotifyChangeKeyValue();
693 TestOpenKey();
694 TestOpenKeyEx();
695 TestQueryInfoKey();
696 TestQueryValue();
697 TestQueryValueEx();
698 TestReplaceKey();
699 TestRestoreKey();
700 TestSaveKey();
701 TestSetKeySecurity();
702 TestSetValue();
703 TestSetValueEx();
704 TestUnLoadKey();
705 TestCreateKeyEx1();
707 /* Now we have some sequence testing */
708 TestSequence1();
710 return 0;