ReactOS 0.4.15-dev-7924-g5949c20
secur32.c File Reference
#include <stdio.h>
#include <stdarg.h>
#include <windef.h>
#include <winbase.h>
#include <winnls.h>
#include <rpc.h>
#include <rpcdce.h>
#include <security.h>
#include <schannel.h>
#include <wincred.h>
#include <winsock2.h>
#include "wine/test.h"
Include dependency graph for secur32.c:

Go to the source code of this file.

Macros

#define SECURITY_WIN32
 

Functions

static SECURITY_STATUS (SEC_ENTRY *pSspiEncodeAuthIdentityAsStrings)(PSEC_WINNT_AUTH_IDENTITY_OPAQUE
 
static PCWSTR PCWSTR PCWSTR *static PSEC_WINNT_AUTH_IDENTITY_OPAQUE *static void (SEC_ENTRY *pSspiFreeAuthIdentity)(PSEC_WINNT_AUTH_IDENTITY_OPAQUE)
 
static BOOLEAN (WINAPI *pGetComputerObjectNameA)(EXTENDED_NAME_FORMAT NameFormat
 
static PSecurityFunctionTableA (SEC_ENTRY *pInitSecurityInterfaceA)(void)
 
static PSecurityFunctionTableW (SEC_ENTRY *pInitSecurityInterfaceW)(void)
 
static void testGetComputerObjectNameA (void)
 
static void testGetComputerObjectNameW (void)
 
static void testGetUserNameExA (void)
 
static void testGetUserNameExW (void)
 
static void test_InitSecurityInterface (void)
 
static void test_SspiEncodeStringsAsAuthIdentity (void)
 
static void test_SspiPrepareForCredWrite (void)
 
static void test_kerberos (void)
 
 START_TEST (secur32)
 

Variables

static HMODULE secdll
 
static PCWSTR PCWSTR PCWSTR *static PCWSTR
 
static PULONG
 
static LPSTR lpNameBuffer
 
static LPSTR PULONG lpnSize
 
static EXTENDED_NAME_FORMAT formats []
 

Macro Definition Documentation

◆ SECURITY_WIN32

#define SECURITY_WIN32

Definition at line 27 of file secur32.c.

Function Documentation

◆ BOOLEAN()

static BOOLEAN ( WINAPI pGetComputerObjectNameA)
static

◆ PSecurityFunctionTableA()

static PSecurityFunctionTableA ( SEC_ENTRY pInitSecurityInterfaceA)
static

◆ PSecurityFunctionTableW()

static PSecurityFunctionTableW ( SEC_ENTRY pInitSecurityInterfaceW)
static

◆ SECURITY_STATUS()

static SECURITY_STATUS ( SEC_ENTRY pSspiEncodeAuthIdentityAsStrings)
static

◆ START_TEST()

START_TEST ( secur32  )

Definition at line 467 of file secur32.c.

468{
469 secdll = LoadLibraryA("secur32.dll");
470
471 if (!secdll)
472 secdll = LoadLibraryA("security.dll");
473
474 if (secdll)
475 {
476 pSspiEncodeAuthIdentityAsStrings = (void *)GetProcAddress(secdll, "SspiEncodeAuthIdentityAsStrings");
477 pSspiEncodeStringsAsAuthIdentity = (void *)GetProcAddress(secdll, "SspiEncodeStringsAsAuthIdentity");
478 pSspiFreeAuthIdentity = (void *)GetProcAddress(secdll, "SspiFreeAuthIdentity");
479 pSspiLocalFree = (void *)GetProcAddress(secdll, "SspiLocalFree");
480 pSspiPrepareForCredWrite = (void *)GetProcAddress(secdll, "SspiPrepareForCredWrite");
481 pSspiZeroAuthIdentity = (void *)GetProcAddress(secdll, "SspiZeroAuthIdentity");
482 pGetComputerObjectNameA = (PVOID)GetProcAddress(secdll, "GetComputerObjectNameA");
483 pGetComputerObjectNameW = (PVOID)GetProcAddress(secdll, "GetComputerObjectNameW");
484 pGetUserNameExA = (PVOID)GetProcAddress(secdll, "GetUserNameExA");
485 pGetUserNameExW = (PVOID)GetProcAddress(secdll, "GetUserNameExW");
486 pInitSecurityInterfaceA = (PVOID)GetProcAddress(secdll, "InitSecurityInterfaceA");
487 pInitSecurityInterfaceW = (PVOID)GetProcAddress(secdll, "InitSecurityInterfaceW");
488
489 if (pGetComputerObjectNameA)
491 else
492 win_skip("GetComputerObjectNameA not exported by secur32.dll\n");
493
494 if (pGetComputerObjectNameW)
496 else
497 win_skip("GetComputerObjectNameW not exported by secur32.dll\n");
498
499 if (pGetUserNameExA)
501 else
502 win_skip("GetUserNameExA not exported by secur32.dll\n");
503
504 if (pGetUserNameExW)
506 else
507 win_skip("GetUserNameExW not exported by secur32.dll\n");
508
512
514 }
515
517}
#define GetProcAddress(x, y)
Definition: compat.h:753
#define FreeLibrary(x)
Definition: compat.h:748
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
#define win_skip
Definition: test.h:160
static void testGetUserNameExA(void)
Definition: secur32.c:154
static void test_kerberos(void)
Definition: secur32.c:416
static void test_SspiEncodeStringsAsAuthIdentity(void)
Definition: secur32.c:278
static HMODULE secdll
Definition: secur32.c:35
static void test_SspiPrepareForCredWrite(void)
Definition: secur32.c:362
static void test_InitSecurityInterface(void)
Definition: secur32.c:248
static void testGetComputerObjectNameW(void)
Definition: secur32.c:108
static void testGetComputerObjectNameA(void)
Definition: secur32.c:63
static void testGetUserNameExW(void)
Definition: secur32.c:201
void * PVOID
Definition: typedefs.h:50

◆ test_InitSecurityInterface()

static void test_InitSecurityInterface ( void  )
static

Definition at line 248 of file secur32.c.

249{
252
253 sftA = pInitSecurityInterfaceA();
254 ok(sftA != NULL, "pInitSecurityInterfaceA failed\n");
255 ok(sftA->dwVersion == SECURITY_SUPPORT_PROVIDER_INTERFACE_VERSION, "wrong dwVersion %d in security function table\n", sftA->dwVersion);
256 ok(!sftA->Reserved2,
257 "Reserved2 should be NULL instead of %p in security function table\n",
258 sftA->Reserved2);
259 ok(sftA->Reserved3 == sftA->EncryptMessage,
260 "Reserved3 should be equal to EncryptMessage in the security function table\n");
261 ok(sftA->Reserved4 == sftA->DecryptMessage,
262 "Reserved4 should be equal to DecryptMessage in the security function table\n");
263
264 if (!pInitSecurityInterfaceW)
265 {
266 win_skip("InitSecurityInterfaceW not exported by secur32.dll\n");
267 return;
268 }
269
270 sftW = pInitSecurityInterfaceW();
271 ok(sftW != NULL, "pInitSecurityInterfaceW failed\n");
272 ok(sftW->dwVersion == SECURITY_SUPPORT_PROVIDER_INTERFACE_VERSION, "wrong dwVersion %d in security function table\n", sftW->dwVersion);
273 ok(!sftW->Reserved2, "Reserved2 should be NULL instead of %p in security function table\n", sftW->Reserved2);
274 ok(sftW->Reserved3 == sftW->EncryptMessage, "Reserved3 should be equal to EncryptMessage in the security function table\n");
275 ok(sftW->Reserved4 == sftW->DecryptMessage, "Reserved4 should be equal to DecryptMessage in the security function table\n");
276}
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
#define SECURITY_SUPPORT_PROVIDER_INTERFACE_VERSION
Definition: sspi.h:1023
ENCRYPT_MESSAGE_FN EncryptMessage
Definition: sspi.h:980
DECRYPT_MESSAGE_FN DecryptMessage
Definition: sspi.h:981
ENCRYPT_MESSAGE_FN EncryptMessage
Definition: sspi.h:1015
DECRYPT_MESSAGE_FN DecryptMessage
Definition: sspi.h:1016

Referenced by START_TEST().

◆ test_kerberos()

static void test_kerberos ( void  )
static

Definition at line 416 of file secur32.c.

417{
419 TimeStamp ttl;
420 CredHandle cred;
422
423 SEC_CHAR provider[] = {'K','e','r','b','e','r','o','s',0};
424
425 static const ULONG expected_flags =
441 static const ULONG optional_mask =
444 | 0x02000000; /* not defined in the SDK */
445
446
448 ok(status == SEC_E_OK, "Kerberos package not installed, skipping test\n");
449 if(status != SEC_E_OK)
450 return;
451
452 ok( (info->fCapabilities & ~optional_mask) == expected_flags, "got %08x, expected %08x\n", info->fCapabilities, expected_flags );
453 ok( info->wVersion == 1, "got %u\n", info->wVersion );
454 ok( info->wRPCID == RPC_C_AUTHN_GSS_KERBEROS, "got %u\n", info->wRPCID );
455 ok( info->cbMaxToken >= 12000, "got %u\n", info->cbMaxToken );
456 ok( !lstrcmpA( info->Name, "Kerberos" ), "got %s\n", info->Name );
457 ok( !lstrcmpA( info->Comment, "Microsoft Kerberos V1.0" ), "got %s\n", info->Comment );
459
461 NULL, NULL, NULL, &cred, &ttl );
462 todo_wine ok( status == SEC_E_OK, "AcquireCredentialsHandleA returned %08x\n", status );
463 if(status == SEC_E_OK)
464 FreeCredentialHandle( &cred );
465}
int WINAPI lstrcmpA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:18
#define todo_wine
Definition: custom.c:79
#define SECPKG_FLAG_APPCONTAINER_CHECKS
Definition: sspi.h:149
#define SECPKG_FLAG_TOKEN_ONLY
Definition: sspi.h:128
LONG SECURITY_STATUS
Definition: sspi.h:34
#define SECPKG_FLAG_IMPERSONATION
Definition: sspi.h:134
#define SECPKG_CRED_OUTBOUND
Definition: sspi.h:291
#define SECPKG_FLAG_EXTENDED_ERROR
Definition: sspi.h:133
#define FreeCredentialHandle
Definition: sspi.h:313
#define SECPKG_FLAG_PRIVACY
Definition: sspi.h:127
CHAR SEC_CHAR
Definition: sspi.h:30
#define SECPKG_FLAG_RESTRICTED_TOKENS
Definition: sspi.h:145
#define SECPKG_FLAG_MULTI_REQUIRED
Definition: sspi.h:131
#define SECPKG_FLAG_CONNECTION
Definition: sspi.h:130
#define SECPKG_FLAG_NEGOTIABLE
Definition: sspi.h:137
#define SECPKG_FLAG_DELEGATION
Definition: sspi.h:143
#define SECPKG_FLAG_INTEGRITY
Definition: sspi.h:126
#define SECPKG_FLAG_MUTUAL_AUTH
Definition: sspi.h:142
#define SECPKG_FLAG_DATAGRAM
Definition: sspi.h:129
#define SECPKG_FLAG_LOGON
Definition: sspi.h:139
#define SECPKG_FLAG_READONLY_WITH_CHECKSUM
Definition: sspi.h:144
#define SECPKG_FLAG_ACCEPT_WIN32_NAME
Definition: sspi.h:135
#define SECPKG_FLAG_GSS_COMPATIBLE
Definition: sspi.h:138
#define RPC_C_AUTHN_GSS_KERBEROS
Definition: rpcdce.h:160
SECURITY_STATUS WINAPI FreeContextBuffer(PVOID pv)
Definition: sspi.c:699
Definition: ps.c:97
uint32_t ULONG
Definition: typedefs.h:59
#define SEC_E_OK
Definition: winerror.h:2356
SECURITY_STATUS WINAPI AcquireCredentialsHandleA(SEC_CHAR *pszPrincipal, SEC_CHAR *pszPackage, ULONG fCredentialsUse, PLUID pvLogonID, PVOID pAuthData, SEC_GET_KEY_FN pGetKeyFn, PVOID pvGetKeyArgument, PCredHandle phCredential, PTimeStamp ptsExpiry)
Definition: wrapper.c:59
SECURITY_STATUS WINAPI QuerySecurityPackageInfoA(SEC_CHAR *pszPackageName, PSecPkgInfoA *ppPackageInfo)
Definition: wrapper.c:683

Referenced by START_TEST().

◆ test_SspiEncodeStringsAsAuthIdentity()

static void test_SspiEncodeStringsAsAuthIdentity ( void  )
static

Definition at line 278 of file secur32.c.

279{
280 static const WCHAR username[] = {'u','s','e','r','n','a','m','e',0};
281 static const WCHAR domainname[] = {'d','o','m','a','i','n','n','a','m','e',0};
282 static const WCHAR password[] = {'p','a','s','s','w','o','r','d',0};
283 const WCHAR *username_ptr, *domainname_ptr, *password_ptr;
286
287 if (!pSspiEncodeStringsAsAuthIdentity)
288 {
289 win_skip( "SspiEncodeAuthIdentityAsStrings not exported by secur32.dll\n" );
290 return;
291 }
292
293 status = pSspiEncodeStringsAsAuthIdentity( NULL, NULL, NULL, NULL );
294 ok( status == SEC_E_INVALID_TOKEN, "got %08x\n", status );
295
296 id = (PSEC_WINNT_AUTH_IDENTITY_OPAQUE)0xdeadbeef;
297 status = pSspiEncodeStringsAsAuthIdentity( NULL, NULL, NULL, &id );
298 ok( status == SEC_E_INVALID_TOKEN, "got %08x\n", status );
299 ok( id == (PSEC_WINNT_AUTH_IDENTITY_OPAQUE)0xdeadbeef, "id set\n" );
300
301 id = NULL;
302 status = pSspiEncodeStringsAsAuthIdentity( NULL, NULL, password, &id );
303 ok( status == SEC_E_OK, "got %08x\n", status );
304 ok( id != NULL, "id not set\n" );
305 pSspiFreeAuthIdentity( id );
306
307 id = NULL;
308 status = pSspiEncodeStringsAsAuthIdentity( NULL, domainname, password, &id );
309 ok( status == SEC_E_OK, "got %08x\n", status );
310 ok( id != NULL, "id not set\n" );
311 pSspiFreeAuthIdentity( id );
312
313 id = NULL;
314 status = pSspiEncodeStringsAsAuthIdentity( username, NULL, password, &id );
315 ok( status == SEC_E_OK, "got %08x\n", status );
316 ok( id != NULL, "id not set\n" );
317 pSspiFreeAuthIdentity( id );
318
319 id = NULL;
320 status = pSspiEncodeStringsAsAuthIdentity( username, NULL, NULL, &id );
321 ok( status == SEC_E_OK, "got %08x\n", status );
322 ok( id != NULL, "id not set\n" );
323 pSspiFreeAuthIdentity( id );
324
325 id = NULL;
326 status = pSspiEncodeStringsAsAuthIdentity( username, domainname, password, &id );
327 ok( status == SEC_E_OK, "got %08x\n", status );
328 ok( id != NULL, "id not set\n" );
329
330 username_ptr = domainname_ptr = password_ptr = NULL;
331 status = pSspiEncodeAuthIdentityAsStrings( id, &username_ptr, &domainname_ptr, &password_ptr );
332 ok( status == SEC_E_OK, "got %08x\n", status );
333 ok( !lstrcmpW( username, username_ptr ), "wrong username\n" );
334 ok( !lstrcmpW( domainname, domainname_ptr ), "wrong domainname\n" );
335 ok( !lstrcmpW( password, password_ptr ), "wrong password\n" );
336
337 pSspiZeroAuthIdentity( id );
338
339 pSspiLocalFree( (void *)username_ptr );
340 pSspiLocalFree( (void *)domainname_ptr );
341 pSspiLocalFree( (void *)password_ptr );
342 pSspiFreeAuthIdentity( id );
343
344 id = NULL;
345 status = pSspiEncodeStringsAsAuthIdentity( username, NULL, password, &id );
346 ok( status == SEC_E_OK, "got %08x\n", status );
347 ok( id != NULL, "id not set\n" );
348
349 username_ptr = password_ptr = NULL;
350 domainname_ptr = (const WCHAR *)0xdeadbeef;
351 status = pSspiEncodeAuthIdentityAsStrings( id, &username_ptr, &domainname_ptr, &password_ptr );
352 ok( status == SEC_E_OK, "got %08x\n", status );
353 ok( !lstrcmpW( username, username_ptr ), "wrong username\n" );
354 ok( domainname_ptr == NULL, "domainname_ptr not cleared\n" );
355 ok( !lstrcmpW( password, password_ptr ), "wrong password\n" );
356
357 pSspiLocalFree( (void *)username_ptr );
358 pSspiLocalFree( (void *)password_ptr );
359 pSspiFreeAuthIdentity( id );
360}
GLuint id
Definition: glext.h:5910
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
static WCHAR password[]
Definition: url.c:33
static WCHAR username[]
Definition: url.c:32
void * PSEC_WINNT_AUTH_IDENTITY_OPAQUE
Definition: sspi.h:96
#define SEC_E_INVALID_TOKEN
Definition: winerror.h:2917
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by START_TEST().

◆ test_SspiPrepareForCredWrite()

static void test_SspiPrepareForCredWrite ( void  )
static

Definition at line 362 of file secur32.c.

363{
364 static const WCHAR usernameW[] =
365 {'u','s','e','r','n','a','m','e',0};
366 static const WCHAR domainnameW[] =
367 {'d','o','m','a','i','n','n','a','m','e',0};
368 static const WCHAR passwordW[] =
369 {'p','a','s','s','w','o','r','d',0};
370 static const WCHAR targetW[] =
371 {'d','o','m','a','i','n','n','a','m','e','\\','u','s','e','r','n','a','m','e',0};
372 static const WCHAR target2W[] =
373 {'d','o','m','a','i','n','n','a','m','e','2','\\','u','s','e','r','n','a','m','e','2',0};
374 const WCHAR *target, *username;
377 ULONG type, size;
378 UCHAR *blob;
379
380 if (!pSspiPrepareForCredWrite)
381 {
382 win_skip( "SspiPrepareForCredWrite not exported by secur32.dll\n" );
383 return;
384 }
385
386 status = pSspiEncodeStringsAsAuthIdentity( usernameW, domainnameW, passwordW, &id );
387 ok( status == SEC_E_OK, "got %08x\n", status );
388
389 type = size = 0;
390 status = pSspiPrepareForCredWrite( id, NULL, &type, &target, &username, &blob, &size );
391 ok( status == SEC_E_OK, "got %08x\n", status );
392 ok( type == CRED_TYPE_DOMAIN_PASSWORD, "got %u\n", type );
393 ok( !lstrcmpW( target, targetW ), "got %s\n", wine_dbgstr_w(target) );
394 ok( !lstrcmpW( username, targetW ), "got %s\n", wine_dbgstr_w(username) );
395 ok( !memcmp( blob, passwordW, sizeof(passwordW) - sizeof(WCHAR) ), "wrong data\n" );
396 ok( size == sizeof(passwordW) - sizeof(WCHAR), "got %u\n", size );
397 pSspiLocalFree( (void *)target );
398 pSspiLocalFree( (void *)username );
399 pSspiLocalFree( blob );
400
401 type = size = 0;
402 status = pSspiPrepareForCredWrite( id, target2W, &type, &target, &username, &blob, &size );
403 ok( status == SEC_E_OK, "got %08x\n", status );
404 ok( type == CRED_TYPE_DOMAIN_PASSWORD, "got %u\n", type );
405 ok( !lstrcmpW( target, target2W ), "got %s\n", wine_dbgstr_w(target) );
406 ok( !lstrcmpW( username, targetW ), "got %s\n", wine_dbgstr_w(username) );
407 ok( !memcmp( blob, passwordW, sizeof(passwordW) - sizeof(WCHAR) ), "wrong data\n" );
408 ok( size == sizeof(passwordW) - sizeof(WCHAR), "got %u\n", size );
409 pSspiLocalFree( (void *)target );
410 pSspiLocalFree( (void *)username );
411 pSspiLocalFree( blob );
412
413 pSspiFreeAuthIdentity( id );
414}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLsizeiptr size
Definition: glext.h:5919
GLenum target
Definition: glext.h:7315
#define wine_dbgstr_w
Definition: kernel32.h:34
Definition: image.c:134
#define CRED_TYPE_DOMAIN_PASSWORD
Definition: wincred.h:205
unsigned char UCHAR
Definition: xmlstorage.h:181

Referenced by START_TEST().

◆ testGetComputerObjectNameA()

static void testGetComputerObjectNameA ( void  )
static

Definition at line 63 of file secur32.c.

64{
65 char name[256];
66 ULONG size;
67 BOOLEAN rc;
68 UINT i;
69
70 for (i = 0; i < ARRAY_SIZE(formats); i++) {
71 size = 0;
72 SetLastError(0xdeadbeef);
73 rc = pGetComputerObjectNameA(formats[i], NULL, &size);
74 ok(!rc, "GetComputerObjectName(%u) should fail\n", formats[i]);
75 switch (formats[i])
76 {
77 case NameUnknown:
79 break;
80 default:
85 "%u: got %u\n", formats[i], GetLastError());
86 break;
87 }
88
89 if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) continue;
90
91 size = sizeof(name);
92 SetLastError(0xdeadbeef);
93 rc = pGetComputerObjectNameA(formats[i], name, &size);
94 switch (formats[i])
95 {
96 case NameUnknown:
97 ok(!rc, "GetComputerObjectName(%u) should fail\n", formats[i]);
99 break;
100 default:
101 ok(rc, "GetComputerObjectName(%u) error %u\n", formats[i], GetLastError());
102 trace("GetComputerObjectName(%u) returned %s\n", formats[i], name);
103 break;
104 }
105 }
106}
unsigned char BOOLEAN
#define trace
Definition: atltest.h:70
#define ARRAY_SIZE(A)
Definition: main.h:33
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define SetLastError(x)
Definition: compat.h:752
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int UINT
Definition: ndis.h:50
static EXTENDED_NAME_FORMAT formats[]
Definition: secur32.c:57
Definition: name.c:39
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define ERROR_CANT_ACCESS_DOMAIN_INFO
Definition: winerror.h:832
#define ERROR_NO_SUCH_USER
Definition: winerror.h:799
#define ERROR_NONE_MAPPED
Definition: winerror.h:814

Referenced by START_TEST().

◆ testGetComputerObjectNameW()

static void testGetComputerObjectNameW ( void  )
static

Definition at line 108 of file secur32.c.

109{
110 WCHAR nameW[256];
111 ULONG size;
112 BOOLEAN rc;
113 UINT i;
114
115 for (i = 0; i < ARRAY_SIZE(formats); i++) {
116 size = 0;
117 SetLastError(0xdeadbeef);
118 rc = pGetComputerObjectNameW(formats[i], NULL, &size);
119 ok(!rc || broken(rc) /* win10 */, "GetComputerObjectName(%u) should fail\n", formats[i]);
120 switch (formats[i])
121 {
122 case NameUnknown:
123 ok(GetLastError() == ERROR_INVALID_PARAMETER, "%u: got %u\n", formats[i], GetLastError());
124 break;
125 default:
131 "%u: got %u\n", formats[i], GetLastError());
132 break;
133 }
134
135 if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) continue;
136
138 SetLastError(0xdeadbeef);
139 rc = pGetComputerObjectNameW(formats[i], nameW, &size);
140 switch (formats[i])
141 {
142 case NameUnknown:
143 ok(!rc, "GetComputerObjectName(%u) should fail\n", formats[i]);
144 ok(GetLastError() == ERROR_INVALID_PARAMETER, "%u: got %u\n", formats[i], GetLastError());
145 break;
146 default:
147 ok(rc, "GetComputerObjectName(%u) error %u\n", formats[i], GetLastError());
148 trace("GetComputerObjectName(%u) returned %s\n", formats[i], wine_dbgstr_w(nameW));
149 break;
150 }
151 }
152}
#define broken(x)
Definition: _sntprintf.h:21
static const WCHAR nameW[]
Definition: main.c:46
#define WSAHOST_NOT_FOUND
Definition: winerror.h:2000

Referenced by START_TEST().

◆ testGetUserNameExA()

static void testGetUserNameExA ( void  )
static

Definition at line 154 of file secur32.c.

155{
156 char name[256];
157 ULONG size;
158 BOOLEAN rc;
159 UINT i;
160
161 for (i = 0; i < ARRAY_SIZE(formats); i++) {
162 size = sizeof(name);
163 ZeroMemory(name, sizeof(name));
164 rc = pGetUserNameExA(formats[i], name, &size);
165 ok(rc ||
166 (formats[i] == NameUnknown &&
169 broken(formats[i] == NameDnsDomain &&
171 "GetUserNameExW(%d) failed: %d\n",
173 }
174
175 if (0) /* Crashes on Windows */
176 pGetUserNameExA(NameSamCompatible, NULL, NULL);
177
178 size = 0;
179 rc = pGetUserNameExA(NameSamCompatible, NULL, &size);
180 ok(! rc && GetLastError() == ERROR_MORE_DATA, "Expected fail with ERROR_MORE_DATA, got %d with %u\n", rc, GetLastError());
181 ok(size != 0, "Expected size to be set to required size\n");
182
183 if (0) /* Crashes on Windows with big enough size */
184 {
185 /* Returned size is already big enough */
186 pGetUserNameExA(NameSamCompatible, NULL, &size);
187 }
188
189 size = 0;
190 rc = pGetUserNameExA(NameSamCompatible, name, &size);
191 ok(! rc && GetLastError() == ERROR_MORE_DATA, "Expected fail with ERROR_MORE_DATA, got %d with %u\n", rc, GetLastError());
192 ok(size != 0, "Expected size to be set to required size\n");
193 size = 1;
194 name[0] = 0xff;
195 rc = pGetUserNameExA(NameSamCompatible, name, &size);
196 ok(! rc && GetLastError() == ERROR_MORE_DATA, "Expected fail with ERROR_MORE_DATA, got %d with %u\n", rc, GetLastError());
197 ok(1 < size, "Expected size to be set to required size\n");
198 ok(name[0] == (char) 0xff, "Expected unchanged buffer\n");
199}
#define ERROR_MORE_DATA
Definition: dderror.h:13
#define ZeroMemory
Definition: winbase.h:1712

Referenced by START_TEST().

◆ testGetUserNameExW()

static void testGetUserNameExW ( void  )
static

Definition at line 201 of file secur32.c.

202{
203 WCHAR nameW[256];
204 ULONG size;
205 BOOLEAN rc;
206 UINT i;
207
208 for (i = 0; i < ARRAY_SIZE(formats); i++) {
209 size = sizeof(nameW);
210 ZeroMemory(nameW, sizeof(nameW));
211 rc = pGetUserNameExW(formats[i], nameW, &size);
212 ok(rc ||
213 (formats[i] == NameUnknown &&
216 broken(formats[i] == NameDnsDomain &&
218 "GetUserNameExW(%d) failed: %d\n",
220 }
221
222 if (0) /* Crashes on Windows */
223 pGetUserNameExW(NameSamCompatible, NULL, NULL);
224
225 size = 0;
226 rc = pGetUserNameExW(NameSamCompatible, NULL, &size);
227 ok(! rc && GetLastError() == ERROR_MORE_DATA, "Expected fail with ERROR_MORE_DATA, got %d with %u\n", rc, GetLastError());
228 ok(size != 0, "Expected size to be set to required size\n");
229
230 if (0) /* Crashes on Windows with big enough size */
231 {
232 /* Returned size is already big enough */
233 pGetUserNameExW(NameSamCompatible, NULL, &size);
234 }
235
236 size = 0;
237 rc = pGetUserNameExW(NameSamCompatible, nameW, &size);
238 ok(! rc && GetLastError() == ERROR_MORE_DATA, "Expected fail with ERROR_MORE_DATA, got %d with %u\n", rc, GetLastError());
239 ok(size != 0, "Expected size to be set to required size\n");
240 size = 1;
241 nameW[0] = 0xff;
242 rc = pGetUserNameExW(NameSamCompatible, nameW, &size);
243 ok(! rc && GetLastError() == ERROR_MORE_DATA, "Expected fail with ERROR_MORE_DATA, got %d with %u\n", rc, GetLastError());
244 ok(1 < size, "Expected size to be set to required size\n");
245 ok(nameW[0] == (WCHAR) 0xff, "Expected unchanged buffer\n");
246}

Referenced by START_TEST().

◆ void()

static PCWSTR PCWSTR PCWSTR *static PSEC_WINNT_AUTH_IDENTITY_OPAQUE *static void ( SEC_ENTRY pSspiFreeAuthIdentity)
static

Variable Documentation

◆ formats

EXTENDED_NAME_FORMAT formats[]
static
Initial value:
= {
NameUnknown, NameFullyQualifiedDN, NameSamCompatible, NameDisplay,
NameUniqueId, NameCanonical, NameUserPrincipal, NameCanonicalEx,
NameServicePrincipal, NameDnsDomain
}

Definition at line 57 of file secur32.c.

Referenced by testGetComputerObjectNameA(), testGetComputerObjectNameW(), testGetUserNameExA(), and testGetUserNameExW().

◆ lpNameBuffer

◆ lpnSize

static LPWSTR PULONG lpnSize

Definition at line 50 of file secur32.c.

Referenced by GetComputerNameA(), GetComputerNameW(), NpGetUserNamep(), and test_normal_imports().

◆ PCWSTR

Definition at line 40 of file secur32.c.

◆ PULONG

Definition at line 46 of file secur32.c.

◆ secdll

HMODULE secdll
static

Definition at line 35 of file secur32.c.

Referenced by START_TEST().