329{
330 CHAR OrigNetBIOS[128];
331 CHAR OrigHostname[128];
332 CHAR OrigDomainName[128];
333 CHAR OrigDhcpHostname[128];
334 CHAR OrigDhcpDomainName[128];
335 BOOL OrigNetBIOSExists;
336 BOOL OrigHostnameExists;
337 BOOL OrigDomainNameExists;
338 BOOL OrigDhcpHostnameExists;
339 BOOL OrigDhcpDomainNameExists;
340 CHAR ComputerName[128];
341 DWORD ComputerNameSize = 0;
344
345 memset(OrigNetBIOS, 0,
sizeof(OrigNetBIOS));
346 memset(OrigHostname, 0,
sizeof(OrigHostname));
347 memset(OrigDomainName, 0,
sizeof(OrigDomainName));
348 memset(OrigDhcpHostname, 0,
sizeof(OrigDhcpHostname));
349 memset(OrigDhcpDomainName, 0,
sizeof(OrigDhcpDomainName));
350
366
367 trace(
"Starting values:\n");
368 trace(
"NetBIOS: %s, exists %s\n", OrigNetBIOS, OrigNetBIOSExists ?
"yes" :
"no");
369 trace(
"Hostname: %s, exists %s\n", OrigHostname, OrigHostnameExists ?
"yes" :
"no");
370 trace(
"Domain: %s, exists %s\n", OrigDomainName, OrigDomainNameExists ?
"yes" :
"no");
371 trace(
"DhcpHostname: %s, exists %s\n", OrigDhcpHostnameExists ? OrigDhcpHostname :
"", OrigDhcpHostnameExists ?
"yes" :
"no");
372 trace(
"DhcpDomain: %s, exists %s\n", OrigDhcpDomainNameExists ? OrigDhcpDomainName :
"", OrigDhcpDomainNameExists ?
"yes" :
"no");
373
374
375 ComputerNameSize = 0;
378 if (ComputerNameSize)
379 {
380 Ret =
GetComputerNameExA(ComputerNamePhysicalNetBIOS, ComputerName, &ComputerNameSize);
381 ok(Ret,
"GetComputerNameExA(ComputerNamePhysicalNetBIOS) failed with %ld\n",
GetLastError());
382 }
383 else
384 {
385 memset(ComputerName, 0,
sizeof(ComputerName));
386 }
387 ok(
strcmp(ComputerName, OrigNetBIOS) == 0,
"ComputerNamePhysicalNetBIOS doesn't match registry value '%s' != '%s'\n", ComputerName, OrigNetBIOS);
389
390
391 ComputerNameSize = 0;
394 if (ComputerNameSize)
395 {
396 Ret =
GetComputerNameExA(ComputerNamePhysicalDnsHostname, ComputerName, &ComputerNameSize);
397 ok(Ret,
"GetComputerNameExA(ComputerNamePhysicalDnsHostname) failed with %ld\n",
GetLastError());
398 }
399 else
400 {
401 memset(ComputerName, 0,
sizeof(ComputerName));
402 }
403 ok(
strcmp(ComputerName, OrigHostname) == 0,
"ComputerNamePhysicalDnsHostname doesn't match registry value '%s' != '%s'\n", ComputerName, OrigHostname);
405
406
407 ComputerNameSize = 0;
410 if (ComputerNameSize)
411 {
412 Ret =
GetComputerNameExA(ComputerNamePhysicalDnsDomain, ComputerName, &ComputerNameSize);
413 ok(Ret,
"GetComputerNameExA(ComputerNamePhysicalDnsDomain) failed with %ld\n",
GetLastError());
414 }
415 else
416 {
417 memset(ComputerName, 0,
sizeof(ComputerName));
418 }
419 ok(
strcmp(ComputerName, OrigDomainName) == 0,
"ComputerNamePhysicalDnsDomain doesn't match registry value '%s' != '%s'\n", ComputerName, OrigDomainName);
421 ComputerNameSize = 0;
422
423
426 if (ComputerNameSize)
427 {
429 ok(Ret,
"GetComputerNameExA(ComputerNameNetBIOS) failed with %ld\n",
GetLastError());
430 }
431 else
432 {
433 memset(ComputerName, 0,
sizeof(ComputerName));
434 }
435 ok(
strcmp(ComputerName, OrigNetBIOS) == 0,
"ComputerNameNetBIOS doesn't match registry value '%s' != '%s'\n", ComputerName, OrigNetBIOS);
437
438
439 ComputerNameSize = 0;
442 if (ComputerNameSize)
443 {
445 ok(Ret,
"GetComputerNameExA(ComputerNameDnsHostname) failed with %ld\n",
GetLastError());
446 }
447 else
448 {
449 memset(ComputerName, 0,
sizeof(ComputerName));
450 }
451 ok(
strcmp(ComputerName, OrigHostname) == 0,
"ComputerNameDnsHostname doesn't match registry value '%s' != '%s'\n", ComputerName, OrigHostname);
453
454
455 ComputerNameSize = 0;
458 if (ComputerNameSize)
459 {
461 ok(Ret,
"GetComputerNameExA(ComputerNameDnsDomain) failed with %ld\n",
GetLastError());
462 }
463 else
464 {
465 memset(ComputerName, 0,
sizeof(ComputerName));
466 }
467 ok(
strcmp(ComputerName, OrigDomainName) == 0,
"ComputerNameDnsDomain doesn't match registry value '%s' != '%s'\n", ComputerName, OrigDomainName);
469
474
475
476 ComputerNameSize = 0;
479 if (ComputerNameSize)
480 {
481 Ret =
GetComputerNameExA(ComputerNamePhysicalNetBIOS, ComputerName, &ComputerNameSize);
482 ok(Ret,
"GetComputerNameExA(ComputerNamePhysicalNetBIOS) failed with %ld\n",
GetLastError());
483 }
484 else
485 {
486 memset(ComputerName, 0,
sizeof(ComputerName));
487 }
488 ok(
strcmp(ComputerName, OrigNetBIOS) == 0,
"ComputerNamePhysicalNetBIOS doesn't match registry value '%s' != '%s'\n", ComputerName, OrigNetBIOS);
490
491
492 ComputerNameSize = 0;
495 if (ComputerNameSize)
496 {
497 Ret =
GetComputerNameExA(ComputerNamePhysicalDnsHostname, ComputerName, &ComputerNameSize);
498 ok(Ret,
"GetComputerNameExA(ComputerNamePhysicalDnsHostname) failed with %ld\n",
GetLastError());
499 }
500 else
501 {
502 memset(ComputerName, 0,
sizeof(ComputerName));
503 }
504 ok(
strcmp(ComputerName, OrigHostname) == 0,
"ComputerNamePhysicalDnsHostname doesn't match registry value '%s' != '%s'\n", ComputerName, OrigHostname);
506
507
508 ComputerNameSize = 0;
511 if (ComputerNameSize)
512 {
513 Ret =
GetComputerNameExA(ComputerNamePhysicalDnsDomain, ComputerName, &ComputerNameSize);
514 ok(Ret,
"GetComputerNameExA(ComputerNamePhysicalDnsDomain) failed with %ld\n",
GetLastError());
515 }
516 else
517 {
518 memset(ComputerName, 0,
sizeof(ComputerName));
519 }
520 ok(
strcmp(ComputerName, OrigDomainName) == 0,
"ComputerNamePhysicalDnsDomain doesn't match registry value '%s' != '%s'\n", ComputerName, OrigDomainName);
522 ComputerNameSize = 0;
523
524
527 if (ComputerNameSize)
528 {
530 ok(Ret,
"GetComputerNameExA(ComputerNameNetBIOS) failed with %ld\n",
GetLastError());
531 }
532 else
533 {
534 memset(ComputerName, 0,
sizeof(ComputerName));
535 }
536 ok(
strcmp(ComputerName, OrigNetBIOS) == 0,
"ComputerNameNetBIOS doesn't match registry value '%s' != '%s'\n", ComputerName, OrigNetBIOS);
538
539
540 ComputerNameSize = 0;
543 if (ComputerNameSize)
544 {
546 ok(Ret,
"GetComputerNameExA(ComputerNameDnsHostname) failed with %ld\n",
GetLastError());
547 }
548 else
549 {
550 memset(ComputerName, 0,
sizeof(ComputerName));
551 }
552 ok(
strcmp(ComputerName, OrigHostname) == 0,
"ComputerNameDnsHostname doesn't match registry value '%s' != '%s'\n", ComputerName, OrigHostname);
554
555
556 ComputerNameSize = 0;
559 if (ComputerNameSize)
560 {
562 ok(Ret,
"GetComputerNameExA(ComputerNameDnsDomain) failed with %ld\n",
GetLastError());
563 }
564 else
565 {
566 memset(ComputerName, 0,
sizeof(ComputerName));
567 }
568 ok(
strcmp(ComputerName, OrigDomainName) == 0,
"ComputerNameDnsDomain doesn't match registry value '%s' != '%s'\n", ComputerName, OrigDomainName);
570
571
572 if (OrigDhcpHostnameExists)
574 else
577 if (OrigDhcpDomainNameExists)
579 else
582}
static LSTATUS DeleteRegistryValue(PCHAR ValueName)
static LSTATUS WriteRegistryValue(PCHAR ValueName, PCHAR Value)
static LSTATUS ReadRegistryComputerNameValue(PCHAR ValueName, PCHAR Value)
static LSTATUS ReadRegistryValue(PCHAR ValueName, PCHAR Value)
int strcmp(const char *String1, const char *String2)
#define ERROR_FILE_NOT_FOUND