Sort entry points alphabetically.
[wine] / dlls / ntdll / version.c
1 /*
2  * Windows and DOS version functions
3  *
4  * Copyright 1997 Marcus Meissner
5  * Copyright 1998 Patrik Stridvall
6  * Copyright 1998, 2003 Andreas Mohr
7  * Copyright 1997, 2003 Alexandre Julliard
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22  */
23
24 #include "config.h"
25 #include "wine/port.h"
26
27 #include <string.h>
28 #include <stdlib.h>
29 #include <stdarg.h>
30 #include <stdio.h>
31 #include "ntstatus.h"
32 #include "windef.h"
33 #include "wine/unicode.h"
34 #include "wine/debug.h"
35 #include "ntdll_misc.h"
36
37 WINE_DEFAULT_DEBUG_CHANNEL(ver);
38
39 typedef enum
40 {
41     WIN20,   /* Windows 2.0 */
42     WIN30,   /* Windows 3.0 */
43     WIN31,   /* Windows 3.1 */
44     WIN95,   /* Windows 95 */
45     WIN98,   /* Windows 98 */
46     WINME,   /* Windows Me */
47     NT351,   /* Windows NT 3.51 */
48     NT40,    /* Windows NT 4.0 */
49     NT2K,    /* Windows 2000 */
50     WINXP,   /* Windows XP */
51     WIN2K3,  /* Windows 2003 */
52     NB_WINDOWS_VERSIONS
53 } WINDOWS_VERSION;
54
55 /* FIXME: compare values below with original and fix.
56  * An *excellent* win9x version page (ALL versions !)
57  * can be found at members.aol.com/axcel216/ver.htm */
58 static const RTL_OSVERSIONINFOEXW VersionData[NB_WINDOWS_VERSIONS] =
59 {
60     /* WIN20 FIXME: verify values */
61     {
62         sizeof(RTL_OSVERSIONINFOEXW), 2, 0, 0, VER_PLATFORM_WIN32s,
63         {'W','i','n','3','2','s',' ','1','.','3',0},
64         0, 0, 0, 0, 0
65     },
66     /* WIN30 FIXME: verify values */
67     {
68         sizeof(RTL_OSVERSIONINFOEXW), 3, 0, 0, VER_PLATFORM_WIN32s,
69         {'W','i','n','3','2','s',' ','1','.','3',0},
70         0, 0, 0, 0, 0
71     },
72     /* WIN31 */
73     {
74         sizeof(RTL_OSVERSIONINFOEXW), 3, 10, 0, VER_PLATFORM_WIN32s,
75         {'W','i','n','3','2','s',' ','1','.','3',0},
76         0, 0, 0, 0, 0
77     },
78     /* WIN95 */
79     {
80         /* Win95:       4, 0, 0x40003B6, ""
81          * Win95sp1:    4, 0, 0x40003B6, " A " (according to doc)
82          * Win95osr2:   4, 0, 0x4000457, " B " (according to doc)
83          * Win95osr2.1: 4, 3, 0x40304BC, " B " (according to doc)
84          * Win95osr2.5: 4, 3, 0x40304BE, " C " (according to doc)
85          * Win95a/b can be discerned via regkey SubVersionNumber
86          * See also:
87          * http://support.microsoft.com/support/kb/articles/q158/2/38.asp
88          */
89         sizeof(RTL_OSVERSIONINFOEXW), 4, 0, 0x40003B6, VER_PLATFORM_WIN32_WINDOWS,
90         {0},
91         0, 0, 0, 0, 0
92     },
93     /* WIN98 (second edition) */
94     {
95         /* Win98:   4, 10, 0x40A07CE, " "   4.10.1998
96          * Win98SE: 4, 10, 0x40A08AE, " A " 4.10.2222
97          */
98         sizeof(RTL_OSVERSIONINFOEXW), 4, 10, 0x40A08AE, VER_PLATFORM_WIN32_WINDOWS,
99         {' ','A',' ',0},
100         0, 0, 0, 0, 0
101     },
102     /* WINME */
103     {
104         sizeof(RTL_OSVERSIONINFOEXW), 4, 90, 0x45A0BB8, VER_PLATFORM_WIN32_WINDOWS,
105         {' ',0},
106         0, 0, 0, 0, 0
107     },
108     /* NT351 */
109     {
110         sizeof(RTL_OSVERSIONINFOEXW), 3, 51, 0x421, VER_PLATFORM_WIN32_NT,
111         {'S','e','r','v','i','c','e',' ','P','a','c','k',' ','2',0},
112         0, 0, 0, 0, 0
113     },
114     /* NT40 */
115     {
116         sizeof(RTL_OSVERSIONINFOEXW), 4, 0, 0x565, VER_PLATFORM_WIN32_NT,
117         {'S','e','r','v','i','c','e',' ','P','a','c','k',' ','6','a',0},
118         6, 0, 0, VER_NT_WORKSTATION, 0
119     },
120     /* NT2K */
121     {
122         sizeof(RTL_OSVERSIONINFOEXW), 5, 0, 0x893, VER_PLATFORM_WIN32_NT,
123         {'S','e','r','v','i','c','e',' ','P','a','c','k',' ','4',0},
124         4, 0, 0, VER_NT_WORKSTATION, 30 /* FIXME: Great, a reserved field with a value! */
125     },
126     /* WINXP */
127     {
128         sizeof(RTL_OSVERSIONINFOEXW), 5, 1, 0xA28, VER_PLATFORM_WIN32_NT,
129         {'S','e','r','v','i','c','e',' ','P','a','c','k',' ','2',0},
130         2, 0, VER_SUITE_SINGLEUSERTS, VER_NT_WORKSTATION, 30 /* FIXME: Great, a reserved field with a value! */
131     },
132     /* WIN2K3 */
133     {
134         sizeof(RTL_OSVERSIONINFOEXW), 5, 2, 0xECE, VER_PLATFORM_WIN32_NT,
135         {'S','e','r','v','i','c','e',' ','P','a','c','k',' ','1',0},
136         1, 0, VER_SUITE_SINGLEUSERTS, VER_NT_SERVER, 0
137     }
138 };
139
140 static const char * const WinVersionNames[NB_WINDOWS_VERSIONS] =
141 { /* no spaces in here ! */
142     "win20",                      /* WIN20 */
143     "win30",                      /* WIN30 */
144     "win31",                      /* WIN31 */
145     "win95",                      /* WIN95 */
146     "win98",                      /* WIN98 */
147     "winme",                      /* WINME */
148     "nt351",                      /* NT351 */
149     "nt40",                       /* NT40 */
150     "win2000,win2k,nt2k,nt2000",  /* NT2K */
151     "winxp",                      /* WINXP */
152     "win2003,win2k3"              /* WIN2K3 */
153 };
154
155 /* names to print out in debug traces */
156 static const char * const debug_names[NB_WINDOWS_VERSIONS] =
157 {
158     "Windows 2.0",       /* WIN20 */
159     "Windows 3.0",       /* WIN30 */
160     "Windows 3.1",       /* WIN31 */
161     "Windows 95",        /* WIN95 */
162     "Windows 98",        /* WIN98 */
163     "Windows Me",        /* WINME */
164     "Windows NT 3.51",   /* NT351 */
165     "Windows NT 4.0",    /* NT40 */
166     "Windows 2000",      /* NT2K */
167     "Windows XP",        /* WINXP */
168     "Windows Server 2003"/* WIN2K3 */
169 };
170
171 /* if one of the following dlls is importing ntdll the windows
172 version autodetection switches wine to unicode (nt 3.51 or 4.0) */
173 static const WCHAR special_dlls[][16] =
174 {
175     {'c','o','m','d','l','g','3','2','.','d','l','l',0},
176     {'c','o','m','c','t','l','3','2','.','d','l','l',0},
177     {'s','h','e','l','l','3','2','.','d','l','l',0},
178     {'o','l','e','3','2','.','d','l','l',0},
179     {'r','p','c','r','t','4','.','d','l','l',0}
180 };
181
182 /* the current version has not been autodetected but forced via cmdline */
183 static BOOL versionForced = FALSE;
184 static WINDOWS_VERSION forcedWinVersion; /* init value irrelevant */
185
186 /**********************************************************************
187  *         parse_win_version
188  *
189  * Parse the contents of the Version key.
190  */
191 static BOOL parse_win_version( HANDLE hkey )
192 {
193     static const WCHAR VersionW[] = {'V','e','r','s','i','o','n',0};
194
195     UNICODE_STRING valueW;
196     char tmp[64], buffer[50];
197     KEY_VALUE_PARTIAL_INFORMATION *info = (KEY_VALUE_PARTIAL_INFORMATION *)tmp;
198     DWORD count, len;
199     int i;
200
201     RtlInitUnicodeString( &valueW, VersionW );
202     if (NtQueryValueKey( hkey, &valueW, KeyValuePartialInformation, tmp, sizeof(tmp), &count ))
203         return FALSE;
204
205     RtlUnicodeToMultiByteN( buffer, sizeof(buffer)-1, &len, (WCHAR *)info->Data, info->DataLength );
206     buffer[len] = 0;
207
208     for (i = 0; i < NB_WINDOWS_VERSIONS; i++)
209     {
210         const char *p, *pCurr = WinVersionNames[i];
211         /* iterate through all winver aliases separated by comma */
212         do {
213             p = strchr(pCurr, ',');
214             len = p ? p - pCurr : strlen(pCurr);
215             if ( (!strncmp( pCurr, buffer, len )) && (buffer[len] == 0) )
216             {
217                 forcedWinVersion = i;
218                 versionForced = TRUE;
219                 TRACE( "got win version %s\n", WinVersionNames[forcedWinVersion] );
220                 return TRUE;
221             }
222             pCurr = p+1;
223         } while (p);
224     }
225
226     MESSAGE("Invalid Windows version value '%s' specified in config file.\n", buffer );
227     MESSAGE("Valid versions are:" );
228     for (i = 0; i < NB_WINDOWS_VERSIONS; i++)
229     {
230         /* only list the first, "official" alias in case of aliases */
231         const char *pCurr = WinVersionNames[i];
232         const char *p = strchr(pCurr, ',');
233         len = (p) ? p - pCurr : strlen(pCurr);
234
235         MESSAGE(" '%.*s'%c", (int)len, pCurr, (i == NB_WINDOWS_VERSIONS - 1) ? '\n' : ',' );
236     }
237     return FALSE;
238 }
239
240
241 /**********************************************************************
242  *         VERSION_Init
243  */
244 void VERSION_Init( const WCHAR *appname )
245 {
246     OBJECT_ATTRIBUTES attr;
247     UNICODE_STRING nameW;
248     HANDLE root, hkey, config_key;
249     static const WCHAR configW[] = {'S','o','f','t','w','a','r','e','\\','W','i','n','e',0};
250     static const WCHAR appdefaultsW[] = {'A','p','p','D','e','f','a','u','l','t','s','\\',0};
251
252     RtlOpenCurrentUser( KEY_ALL_ACCESS, &root );
253     attr.Length = sizeof(attr);
254     attr.RootDirectory = root;
255     attr.ObjectName = &nameW;
256     attr.Attributes = 0;
257     attr.SecurityDescriptor = NULL;
258     attr.SecurityQualityOfService = NULL;
259     RtlInitUnicodeString( &nameW, configW );
260
261     /* @@ Wine registry key: HKCU\Software\Wine */
262     if (NtOpenKey( &config_key, KEY_ALL_ACCESS, &attr )) config_key = 0;
263     NtClose( root );
264     if (!config_key) return;
265
266     /* open AppDefaults\\appname key */
267     if (appname && *appname)
268     {
269         const WCHAR *p;
270         WCHAR appversion[MAX_PATH+20];
271         BOOL got_win_ver = FALSE;
272
273         if ((p = strrchrW( appname, '/' ))) appname = p + 1;
274         if ((p = strrchrW( appname, '\\' ))) appname = p + 1;
275
276         strcpyW( appversion, appdefaultsW );
277         strcatW( appversion, appname );
278         TRACE( "getting version from %s\n", debugstr_w(appversion) );
279         RtlInitUnicodeString( &nameW, appversion );
280         attr.RootDirectory = config_key;
281
282         /* @@ Wine registry key: HKCU\Software\Wine\AppDefaults\app.exe */
283         if (!NtOpenKey( &hkey, KEY_ALL_ACCESS, &attr ))
284         {
285             got_win_ver = parse_win_version( hkey );
286             NtClose( hkey );
287         }
288         if (got_win_ver) goto done;
289     }
290
291     TRACE( "getting default version\n" );
292     parse_win_version( config_key );
293
294  done:
295     NtClose( config_key );
296 }
297
298 /**********************************************************************
299  *         VERSION_GetVersion
300  *
301  * WARNING !!!
302  * Don't call this function too early during the Wine init,
303  * as pdb->exe_modref (required by VERSION_GetImageVersion()) might still
304  * be NULL in such cases, which causes the winver to ALWAYS be detected
305  * as WIN31.
306  * And as we cache the winver once it has been determined, this is bad.
307  * This can happen much easier than you might think, as this function
308  * is called by EVERY GetVersion*() API !
309  *
310  */
311 static const RTL_OSVERSIONINFOEXW *VERSION_GetVersion(void)
312 {
313     static WORD winver = WIN98;
314
315     if (versionForced)
316         return &VersionData[forcedWinVersion];  /* user has overridden any sensible checks */
317
318     return &VersionData[winver];
319 }
320
321
322 /***********************************************************************
323  *         RtlGetVersion   (NTDLL.@)
324  */
325 NTSTATUS WINAPI RtlGetVersion( RTL_OSVERSIONINFOEXW *info )
326 {
327     const RTL_OSVERSIONINFOEXW * const current = VERSION_GetVersion();
328
329     info->dwMajorVersion = current->dwMajorVersion;
330     info->dwMinorVersion = current->dwMinorVersion;
331     info->dwBuildNumber  = current->dwBuildNumber;
332     info->dwPlatformId   = current->dwPlatformId;
333     strcpyW( info->szCSDVersion, current->szCSDVersion );
334     if(info->dwOSVersionInfoSize == sizeof(RTL_OSVERSIONINFOEXW))
335     {
336         info->wServicePackMajor = current->wServicePackMajor;
337         info->wServicePackMinor = current->wServicePackMinor;
338         info->wSuiteMask        = current->wSuiteMask;
339         info->wProductType      = current->wProductType;
340     }
341     TRACE("<-- %s (%s)\n", debug_names[current - VersionData], debugstr_w(current->szCSDVersion) );
342     return STATUS_SUCCESS;
343 }
344
345
346 /******************************************************************************
347  *  RtlGetNtVersionNumbers   (NTDLL.@)
348  *
349  * Get the version numbers of the run time library.
350  *
351  * PARAMS
352  *  major [O] Destination for the Major version
353  *  minor [O] Destination for the Minor version
354  *  build [O] Destination for the Build version
355  *
356  * RETURNS
357  *  Nothing.
358  *
359  * NOTES
360  * Introduced in Windows XP (NT5.1)
361  */
362 void WINAPI RtlGetNtVersionNumbers( LPDWORD major, LPDWORD minor, LPDWORD build )
363 {
364     const RTL_OSVERSIONINFOEXW * const current = VERSION_GetVersion();
365
366     if (major) *major = current->dwMajorVersion;
367     if (minor) *minor = current->dwMinorVersion;
368     /* FIXME: Does anybody know the real formula? */
369     if (build) *build = (0xF0000000 | current->dwBuildNumber);
370 }
371
372
373 /******************************************************************************
374  *        VerifyVersionInfoW   (KERNEL32.@)
375  */
376 NTSTATUS WINAPI RtlVerifyVersionInfo( const RTL_OSVERSIONINFOEXW *info,
377                                       DWORD dwTypeMask, DWORDLONG dwlConditionMask )
378 {
379     RTL_OSVERSIONINFOEXW ver;
380     NTSTATUS status;
381
382     FIXME("(%p,%lu,%llx): Not all cases correctly implemented yet\n",
383           info, dwTypeMask, dwlConditionMask);
384
385     /* FIXME:
386         - Check the following special case on Windows (various versions):
387           o lp->wSuiteMask == 0 and ver.wSuiteMask != 0 and VER_AND/VER_OR
388           o lp->dwOSVersionInfoSize != sizeof(OSVERSIONINFOEXW)
389         - MSDN talks about some tests being impossible. Check what really happens.
390      */
391
392     ver.dwOSVersionInfoSize = sizeof(ver);
393     if ((status = RtlGetVersion( &ver )) != STATUS_SUCCESS) return status;
394
395     if(!(dwTypeMask && dwlConditionMask)) return STATUS_INVALID_PARAMETER;
396
397     if(dwTypeMask & VER_PRODUCT_TYPE)
398         switch(dwlConditionMask >> 7*3 & 0x07) {
399             case VER_EQUAL:
400                 if(ver.wProductType != info->wProductType) return STATUS_REVISION_MISMATCH;
401                 break;
402             case VER_GREATER:
403                 if(ver.wProductType <= info->wProductType) return STATUS_REVISION_MISMATCH;
404                 break;
405             case VER_GREATER_EQUAL:
406                 if(ver.wProductType < info->wProductType) return STATUS_REVISION_MISMATCH;
407                 break;
408             case VER_LESS:
409                 if(ver.wProductType >= info->wProductType) return STATUS_REVISION_MISMATCH;
410                 break;
411             case VER_LESS_EQUAL:
412                 if(ver.wProductType > info->wProductType) return STATUS_REVISION_MISMATCH;
413                 break;
414             default:
415                 return STATUS_INVALID_PARAMETER;
416         }
417     if(dwTypeMask & VER_SUITENAME)
418         switch(dwlConditionMask >> 6*3 & 0x07)
419         {
420             case VER_AND:
421                 if((info->wSuiteMask & ver.wSuiteMask) != info->wSuiteMask)
422                     return STATUS_REVISION_MISMATCH;
423                 break;
424             case VER_OR:
425                 if(!(info->wSuiteMask & ver.wSuiteMask) && info->wSuiteMask)
426                     return STATUS_REVISION_MISMATCH;
427                 break;
428             default:
429                 return STATUS_INVALID_PARAMETER;
430         }
431     if(dwTypeMask & VER_PLATFORMID)
432         switch(dwlConditionMask >> 3*3 & 0x07)
433         {
434             case VER_EQUAL:
435                 if(ver.dwPlatformId != info->dwPlatformId) return STATUS_REVISION_MISMATCH;
436                 break;
437             case VER_GREATER:
438                 if(ver.dwPlatformId <= info->dwPlatformId) return STATUS_REVISION_MISMATCH;
439                 break;
440             case VER_GREATER_EQUAL:
441                 if(ver.dwPlatformId < info->dwPlatformId) return STATUS_REVISION_MISMATCH;
442                 break;
443             case VER_LESS:
444                 if(ver.dwPlatformId >= info->dwPlatformId) return STATUS_REVISION_MISMATCH;
445                 break;
446             case VER_LESS_EQUAL:
447                 if(ver.dwPlatformId > info->dwPlatformId) return STATUS_REVISION_MISMATCH;
448                 break;
449             default:
450                 return STATUS_INVALID_PARAMETER;
451         }
452     if(dwTypeMask & VER_BUILDNUMBER)
453         switch(dwlConditionMask >> 2*3 & 0x07)
454         {
455             case VER_EQUAL:
456                 if(ver.dwBuildNumber != info->dwBuildNumber) return STATUS_REVISION_MISMATCH;
457                 break;
458             case VER_GREATER:
459                 if(ver.dwBuildNumber <= info->dwBuildNumber) return STATUS_REVISION_MISMATCH;
460                 break;
461             case VER_GREATER_EQUAL:
462                 if(ver.dwBuildNumber < info->dwBuildNumber) return STATUS_REVISION_MISMATCH;
463                 break;
464             case VER_LESS:
465                 if(ver.dwBuildNumber >= info->dwBuildNumber) return STATUS_REVISION_MISMATCH;
466                 break;
467             case VER_LESS_EQUAL:
468                 if(ver.dwBuildNumber > info->dwBuildNumber) return STATUS_REVISION_MISMATCH;
469                 break;
470             default:
471                 return STATUS_INVALID_PARAMETER;
472         }
473     if(dwTypeMask & VER_MAJORVERSION)
474         switch(dwlConditionMask >> 1*3 & 0x07)
475         {
476             case VER_EQUAL:
477                 if(ver.dwMajorVersion != info->dwMajorVersion) return STATUS_REVISION_MISMATCH;
478                 break;
479             case VER_GREATER:
480                 if(ver.dwMajorVersion <= info->dwMajorVersion) return STATUS_REVISION_MISMATCH;
481                 break;
482             case VER_GREATER_EQUAL:
483                 if(ver.dwMajorVersion < info->dwMajorVersion) return STATUS_REVISION_MISMATCH;
484                 break;
485             case VER_LESS:
486                 if(ver.dwMajorVersion >= info->dwMajorVersion) return STATUS_REVISION_MISMATCH;
487                 break;
488             case VER_LESS_EQUAL:
489                 if(ver.dwMajorVersion > info->dwMajorVersion) return STATUS_REVISION_MISMATCH;
490                 break;
491             default:
492                 return STATUS_INVALID_PARAMETER;
493         }
494     if(dwTypeMask & VER_MINORVERSION)
495         switch(dwlConditionMask >> 0*3 & 0x07)
496         {
497             case VER_EQUAL:
498                 if(ver.dwMinorVersion != info->dwMinorVersion) return STATUS_REVISION_MISMATCH;
499                 break;
500             case VER_GREATER:
501                 if(ver.dwMinorVersion <= info->dwMinorVersion) return STATUS_REVISION_MISMATCH;
502                 break;
503             case VER_GREATER_EQUAL:
504                 if(ver.dwMinorVersion < info->dwMinorVersion) return STATUS_REVISION_MISMATCH;
505                 break;
506             case VER_LESS:
507                 if(ver.dwMinorVersion >= info->dwMinorVersion) return STATUS_REVISION_MISMATCH;
508                 break;
509             case VER_LESS_EQUAL:
510                 if(ver.dwMinorVersion > info->dwMinorVersion) return STATUS_REVISION_MISMATCH;
511                 break;
512             default:
513                 return STATUS_INVALID_PARAMETER;
514         }
515     if(dwTypeMask & VER_SERVICEPACKMAJOR)
516         switch(dwlConditionMask >> 5*3 & 0x07)
517         {
518             case VER_EQUAL:
519                 if(ver.wServicePackMajor != info->wServicePackMajor) return STATUS_REVISION_MISMATCH;
520                 break;
521             case VER_GREATER:
522                 if(ver.wServicePackMajor <= info->wServicePackMajor) return STATUS_REVISION_MISMATCH;
523                 break;
524             case VER_GREATER_EQUAL:
525                 if(ver.wServicePackMajor < info->wServicePackMajor) return STATUS_REVISION_MISMATCH;
526                 break;
527             case VER_LESS:
528                 if(ver.wServicePackMajor >= info->wServicePackMajor) return STATUS_REVISION_MISMATCH;
529                 break;
530             case VER_LESS_EQUAL:
531                 if(ver.wServicePackMajor > info->wServicePackMajor) return STATUS_REVISION_MISMATCH;
532                 break;
533             default:
534                 return STATUS_INVALID_PARAMETER;
535         }
536     if(dwTypeMask & VER_SERVICEPACKMINOR)
537         switch(dwlConditionMask >> 4*3 & 0x07)
538         {
539             case VER_EQUAL:
540                 if(ver.wServicePackMinor != info->wServicePackMinor) return STATUS_REVISION_MISMATCH;
541                 break;
542             case VER_GREATER:
543                 if(ver.wServicePackMinor <= info->wServicePackMinor) return STATUS_REVISION_MISMATCH;
544                 break;
545             case VER_GREATER_EQUAL:
546                 if(ver.wServicePackMinor < info->wServicePackMinor) return STATUS_REVISION_MISMATCH;
547                 break;
548             case VER_LESS:
549                 if(ver.wServicePackMinor >= info->wServicePackMinor) return STATUS_REVISION_MISMATCH;
550                 break;
551             case VER_LESS_EQUAL:
552                 if(ver.wServicePackMinor > info->wServicePackMinor) return STATUS_REVISION_MISMATCH;
553                 break;
554             default:
555                 return STATUS_INVALID_PARAMETER;
556         }
557
558     return STATUS_SUCCESS;
559 }