ReactOS  0.4.13-dev-100-gc8611ae
globals.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _ADMIN_INFO
 

Typedefs

typedef struct _ADMIN_INFO ADMIN_INFO
 
typedef struct _ADMIN_INFOPADMIN_INFO
 

Functions

BOOL RegisterTypeLibraries (HINF hinf, LPCWSTR szSection)
 
VOID InstallSecurity (VOID)
 
NTSTATUS SetAdministratorPassword (LPCWSTR Password)
 
VOID SetAutoAdminLogon (VOID)
 
VOID InstallWizard (VOID)
 

Variables

HINSTANCE hDllInstance
 
HINF hSysSetupInf
 
ADMIN_INFO AdminInfo
 

Typedef Documentation

◆ ADMIN_INFO

◆ PADMIN_INFO

Function Documentation

◆ InstallSecurity()

VOID InstallSecurity ( VOID  )

Definition at line 590 of file security.c.

591 {
592  HINF hSecurityInf;
593  PWSTR pszSecurityInf;
594 
595 // if (IsServer())
596 // pszSecurityInf = L"defltsv.inf";
597 // else
598  pszSecurityInf = L"defltws.inf";
599 
601 
602  hSecurityInf = SetupOpenInfFileW(pszSecurityInf,
603  NULL,
605  NULL);
606  if (hSecurityInf != INVALID_HANDLE_VALUE)
607  {
608  InstallPrivileges(hSecurityInf);
609  ApplyRegistryValues(hSecurityInf);
610 
611  SetupCloseInfFile(hSecurityInf);
612  }
613 
614  /* Hack */
615  SetPrimaryDomain(L"WORKGROUP", NULL);
616 }
static VOID InstallPrivileges(HINF hSecurityInf)
Definition: security.c:274
#define INF_STYLE_WIN4
Definition: infsupp.h:41
uint16_t * PWSTR
Definition: typedefs.h:54
static VOID InstallBuiltinAccounts(VOID)
Definition: security.c:214
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
HINF WINAPI SetupOpenInfFileW(PCWSTR name, PCWSTR class, DWORD style, UINT *error)
Definition: parser.c:1229
VOID WINAPI SetupCloseInfFile(IN HINF InfHandle)
Definition: infsupp.c:43
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR L[]
Definition: oid.c:1250
static VOID ApplyRegistryValues(HINF hSecurityInf)
Definition: security.c:392
static NTSTATUS SetPrimaryDomain(LPCWSTR DomainName, PSID DomainSid)
Definition: security.c:140

Referenced by InstallReactOS().

◆ InstallWizard()

VOID InstallWizard ( VOID  )

Definition at line 2632 of file wizard.c.

2633 {
2634  PROPSHEETHEADER psh;
2635  HPROPSHEETPAGE *phpage = NULL;
2636  PROPSHEETPAGE psp = {0};
2637  UINT nPages = 0;
2638  HWND hWnd;
2639  MSG msg;
2640  PSETUPDATA pSetupData = NULL;
2641  HMODULE hNetShell = NULL;
2643  DWORD dwPageCount = 9, dwNetworkPageCount = 0;
2644 
2645  LogItem(L"BEGIN_SECTION", L"InstallWizard");
2646 
2647  /* Allocate setup data */
2648  pSetupData = HeapAlloc(GetProcessHeap(),
2650  sizeof(SETUPDATA));
2651  if (pSetupData == NULL)
2652  {
2653  LogItem(NULL, L"SetupData allocation failed!");
2654  MessageBoxW(NULL,
2655  L"Setup failed to allocate global data!",
2656  L"ReactOS Setup",
2657  MB_ICONERROR | MB_OK);
2658  goto done;
2659  }
2660 
2661  hNetShell = LoadLibraryW(L"netshell.dll");
2662  if (hNetShell != NULL)
2663  {
2664  DPRINT("Netshell.dll loaded!\n");
2665 
2666  pfn = (PFNREQUESTWIZARDPAGES)GetProcAddress(hNetShell,
2667  "NetSetupRequestWizardPages");
2668  if (pfn != NULL)
2669  {
2670  pfn(&dwNetworkPageCount, NULL, NULL);
2671  dwPageCount += dwNetworkPageCount;
2672  }
2673  }
2674 
2675  DPRINT("PageCount: %lu\n", dwPageCount);
2676 
2677  phpage = HeapAlloc(GetProcessHeap(),
2679  dwPageCount * sizeof(HPROPSHEETPAGE));
2680  if (phpage == NULL)
2681  {
2682  LogItem(NULL, L"Page array allocation failed!");
2683  MessageBoxW(NULL,
2684  L"Setup failed to allocate page array!",
2685  L"ReactOS Setup",
2686  MB_ICONERROR | MB_OK);
2687  goto done;
2688  }
2689 
2690  /* Process the $winnt$.inf setup file */
2691  ProcessSetupInf(pSetupData);
2692 
2693  /* Create the Welcome page */
2694  psp.dwSize = sizeof(PROPSHEETPAGE);
2695  psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
2696  psp.hInstance = hDllInstance;
2697  psp.lParam = (LPARAM)pSetupData;
2698  psp.pfnDlgProc = WelcomeDlgProc;
2699  psp.pszTemplate = MAKEINTRESOURCE(IDD_WELCOMEPAGE);
2700  phpage[nPages++] = CreatePropertySheetPage(&psp);
2701 
2702  /* Create the Acknowledgements page */
2703  psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
2704  psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_ACKTITLE);
2705  psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_ACKSUBTITLE);
2706  psp.pszTemplate = MAKEINTRESOURCE(IDD_ACKPAGE);
2707  psp.pfnDlgProc = AckPageDlgProc;
2708  phpage[nPages++] = CreatePropertySheetPage(&psp);
2709 
2710  /* Create the Locale page */
2711  psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
2712  psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_LOCALETITLE);
2713  psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_LOCALESUBTITLE);
2714  psp.pfnDlgProc = LocalePageDlgProc;
2715  psp.pszTemplate = MAKEINTRESOURCE(IDD_LOCALEPAGE);
2716  phpage[nPages++] = CreatePropertySheetPage(&psp);
2717 
2718  /* Create the Owner page */
2719  psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
2720  psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_OWNERTITLE);
2721  psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_OWNERSUBTITLE);
2722  psp.pszTemplate = MAKEINTRESOURCE(IDD_OWNERPAGE);
2723  psp.pfnDlgProc = OwnerPageDlgProc;
2724  phpage[nPages++] = CreatePropertySheetPage(&psp);
2725 
2726  /* Create the Computer page */
2727  psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
2728  psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_COMPUTERTITLE);
2729  psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_COMPUTERSUBTITLE);
2730  psp.pfnDlgProc = ComputerPageDlgProc;
2731  psp.pszTemplate = MAKEINTRESOURCE(IDD_COMPUTERPAGE);
2732  phpage[nPages++] = CreatePropertySheetPage(&psp);
2733 
2734  /* Create the DateTime page */
2735  psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
2736  psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_DATETIMETITLE);
2737  psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_DATETIMESUBTITLE);
2738  psp.pfnDlgProc = DateTimePageDlgProc;
2739  psp.pszTemplate = MAKEINTRESOURCE(IDD_DATETIMEPAGE);
2740  phpage[nPages++] = CreatePropertySheetPage(&psp);
2741 
2742  /* Create the theme selection page */
2743  psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
2744  psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_THEMESELECTIONTITLE);
2745  psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_THEMESELECTIONSUBTITLE);
2746  psp.pfnDlgProc = ThemePageDlgProc;
2747  psp.pszTemplate = MAKEINTRESOURCE(IDD_THEMEPAGE);
2748  phpage[nPages++] = CreatePropertySheetPage(&psp);
2749 
2752 
2753  if (pfn)
2754  {
2755  pfn(&dwNetworkPageCount, &phpage[nPages], pSetupData);
2756  nPages += dwNetworkPageCount;
2757  }
2758 
2759  /* Create the Process page */
2760  psp.dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
2761  psp.pszHeaderTitle = MAKEINTRESOURCE(IDS_PROCESSTITLE);
2762  psp.pszHeaderSubTitle = MAKEINTRESOURCE(IDS_PROCESSSUBTITLE);
2763  psp.pfnDlgProc = ProcessPageDlgProc;
2764  psp.pszTemplate = MAKEINTRESOURCE(IDD_PROCESSPAGE);
2765  phpage[nPages++] = CreatePropertySheetPage(&psp);
2766 
2767  /* Create the Finish page */
2768  psp.dwFlags = PSP_DEFAULT | PSP_HIDEHEADER;
2769  psp.pfnDlgProc = FinishDlgProc;
2770  psp.pszTemplate = MAKEINTRESOURCE(IDD_FINISHPAGE);
2771  phpage[nPages++] = CreatePropertySheetPage(&psp);
2772 
2773  ASSERT(nPages == dwPageCount);
2774 
2775  /* Create the property sheet */
2776  psh.dwSize = sizeof(PROPSHEETHEADER);
2777  psh.dwFlags = PSH_WIZARD97 | PSH_WATERMARK | PSH_HEADER | PSH_MODELESS;
2778  psh.hInstance = hDllInstance;
2779  psh.hwndParent = NULL;
2780  psh.nPages = nPages;
2781  psh.nStartPage = 0;
2782  psh.phpage = phpage;
2783  psh.pszbmWatermark = MAKEINTRESOURCE(IDB_WATERMARK);
2784  psh.pszbmHeader = MAKEINTRESOURCE(IDB_HEADER);
2785 
2786  /* Create title font */
2787  pSetupData->hTitleFont = CreateTitleFont();
2788  pSetupData->hBoldFont = CreateBoldFont();
2789 
2790  /* Display the wizard */
2791  hWnd = (HWND)PropertySheet(&psh);
2793 
2794  while (GetMessage(&msg, NULL, 0, 0))
2795  {
2796  if (!IsDialogMessage(hWnd, &msg))
2797  {
2799  DispatchMessage(&msg);
2800  }
2801  }
2802 
2803  DeleteObject(pSetupData->hBoldFont);
2804  DeleteObject(pSetupData->hTitleFont);
2805 
2806  if (pSetupData->hSetupInf != INVALID_HANDLE_VALUE)
2807  SetupCloseInfFile(pSetupData->hSetupInf);
2808 
2809 done:
2810  if (phpage != NULL)
2811  HeapFree(GetProcessHeap(), 0, phpage);
2812 
2813  if (hNetShell != NULL)
2814  FreeLibrary(hNetShell);
2815 
2816  if (pSetupData != NULL)
2817  HeapFree(GetProcessHeap(), 0, pSetupData);
2818 
2819  LogItem(L"END_SECTION", L"InstallWizard");
2820 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
static INT_PTR CALLBACK ProcessPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: wizard.c:1983
#define DispatchMessage
Definition: winuser.h:5631
BOOL WINAPI TranslateMessage(_In_ const MSG *)
#define IDS_OWNERSUBTITLE
Definition: resource.h:95
#define IDS_PROCESSTITLE
Definition: resource.h:84
static INT_PTR CALLBACK WelcomeDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: wizard.c:190
#define IDS_ACKSUBTITLE
Definition: resource.h:92
static HFONT CreateTitleFont(VOID)
Definition: wizard.c:79
#define IDD_COMPUTERPAGE
Definition: resource.h:47
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
static INT_PTR CALLBACK LocalePageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: wizard.c:932
static INT_PTR CALLBACK AckPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: wizard.c:274
#define IDS_THEMESELECTIONSUBTITLE
Definition: resource.h:110
HWND hWnd
Definition: settings.c:17
VOID ProcessSetupInf(IN OUT PSETUPDATA pSetupData)
Definition: wizard.c:2499
static INT_PTR CALLBACK ComputerPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: wizard.c:639
HANDLE HWND
Definition: compat.h:13
static INT_PTR CALLBACK ThemePageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: wizard.c:1610
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
#define IDD_DATETIMEPAGE
Definition: resource.h:5
#define IDS_DATETIMESUBTITLE
Definition: resource.h:104
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define PSH_MODELESS
Definition: prsht.h:50
#define IsDialogMessage
Definition: winuser.h:5675
#define IDB_HEADER
Definition: resource.h:30
#define IDD_OWNERPAGE
Definition: resource.h:43
HINF hSetupInf
Definition: syssetup.h:70
#define IDD_PROCESSPAGE
Definition: resource.h:54
VOID WINAPI SetupCloseInfFile(IN HINF InfHandle)
Definition: infsupp.c:43
DWORD(WINAPI * PFNREQUESTWIZARDPAGES)(PDWORD, HPROPSHEETPAGE *, PSETUPDATA)
Definition: wizard.c:2629
#define IDS_THEMESELECTIONTITLE
Definition: resource.h:109
#define IDS_COMPUTERTITLE
Definition: resource.h:97
#define IDS_DATETIMETITLE
Definition: resource.h:103
#define IDS_ACKTITLE
Definition: resource.h:91
#define IDS_PROCESSSUBTITLE
Definition: resource.h:85
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
static INT_PTR CALLBACK DateTimePageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: wizard.c:1511
#define LoadLibraryW(x)
Definition: compat.h:404
smooth NULL
Definition: ftsmooth.c:416
#define PROPSHEETHEADER
Definition: prsht.h:374
LONG_PTR LPARAM
Definition: windef.h:208
void DPRINT(...)
Definition: polytest.cpp:61
#define SW_SHOW
Definition: winuser.h:769
static HFONT CreateBoldFont(VOID)
Definition: wizard.c:100
#define IDD_WELCOMEPAGE
Definition: resource.h:21
#define CreatePropertySheetPage
Definition: prsht.h:381
static HINSTANCE hDllInstance
Definition: clb.c:30
#define PSP_DEFAULT
Definition: prsht.h:22
#define IDD_ACKPAGE
Definition: resource.h:39
static INT_PTR CALLBACK OwnerPageDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: wizard.c:424
UINT uPostNetworkWizardPage
Definition: syssetup.h:73
#define FreeLibrary(x)
Definition: compat.h:405
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
UINT uFirstNetworkWizardPage
Definition: syssetup.h:72
unsigned long DWORD
Definition: ntddk_ex.h:95
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
static const WCHAR L[]
Definition: oid.c:1250
#define IDD_LOCALEPAGE
Definition: resource.h:13
#define MB_ICONERROR
Definition: winuser.h:781
#define IDD_FINISHPAGE
Definition: resource.h:34
static INT_PTR CALLBACK FinishDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: wizard.c:2118
HFONT hBoldFont
Definition: syssetup.h:51
#define IDS_OWNERTITLE
Definition: resource.h:94
#define IDB_WATERMARK
Definition: resource.h:4
unsigned int UINT
Definition: ndis.h:50
#define MB_OK
Definition: winuser.h:784
#define GetMessage
Definition: winuser.h:5656
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define IDS_COMPUTERSUBTITLE
Definition: resource.h:98
#define msg(x)
Definition: auth_time.c:54
#define PropertySheet
Definition: prsht.h:382
#define GetProcAddress(x, y)
Definition: compat.h:410
HFONT hTitleFont
Definition: reactos.h:117
#define IDS_LOCALESUBTITLE
Definition: resource.h:101
#define IDS_LOCALETITLE
Definition: resource.h:100
#define HeapFree(x, y, z)
Definition: compat.h:394
#define PROPSHEETPAGE
Definition: prsht.h:371
#define IDD_THEMEPAGE
Definition: resource.h:73
#define LogItem(lpTag, lpMessageText...)
Definition: syssetup.h:110

Referenced by InstallReactOS().

◆ RegisterTypeLibraries()

BOOL RegisterTypeLibraries ( HINF  hinf,
LPCWSTR  szSection 
)

Definition at line 423 of file install.c.

424 {
425  INFCONTEXT InfContext;
426  BOOL res;
429  INT csidl;
430  LPWSTR p;
431  HMODULE hmod;
432  HRESULT hret;
433 
434  /* Begin iterating the entries in the inf section */
435  res = SetupFindFirstLine(hinf, szSection, NULL, &InfContext);
436  if (!res) return FALSE;
437 
438  do
439  {
440  /* Get the name of the current type library */
441  if (!SetupGetStringFieldW(&InfContext, 1, szName, ARRAYSIZE(szName), NULL))
442  {
443  FatalError("SetupGetStringFieldW failed\n");
444  continue;
445  }
446 
447  if (!SetupGetIntField(&InfContext, 2, &csidl))
448  csidl = CSIDL_SYSTEM;
449 
450  hret = SHGetFolderPathW(NULL, csidl, NULL, 0, szPath);
451  if (FAILED(hret))
452  {
453  FatalError("SHGetFolderPathW failed hret=0x%lx\n", hret);
454  continue;
455  }
456 
458  wcscpy(p, szName);
459 
461  if (hmod == NULL)
462  {
463  FatalError("LoadLibraryW failed\n");
464  continue;
465  }
466 
468 
469  } while (SetupFindNextLine(&InfContext, &InfContext));
470 
471  return TRUE;
472 }
#define TRUE
Definition: types.h:120
HRESULT __wine_register_resources(HMODULE module) DECLSPEC_HIDDEN
Definition: register.c:98
#define SetupFindFirstLine
Definition: setupapi.h:2618
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
int32_t INT
Definition: typedefs.h:56
unsigned int BOOL
Definition: ntddk_ex.h:94
#define PathAddBackslash
Definition: shlwapi.h:783
#define LoadLibraryW(x)
Definition: compat.h:404
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define MAX_PATH
Definition: compat.h:26
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static PEXPLICIT_ACCESSW *static HMODULE hmod
Definition: security.c:141
LPCWSTR szPath
Definition: env.c:35
BOOL WINAPI SetupFindNextLine(IN PINFCONTEXT ContextIn, OUT PINFCONTEXT ContextOut)
Definition: infsupp.c:80
HRESULT WINAPI SHGetFolderPathW(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPWSTR pszPath)
Definition: shellpath.c:2085
static const WCHAR szName[]
Definition: msipriv.h:1194
BOOL WINAPI SetupGetIntField(IN PINFCONTEXT Context, IN ULONG FieldIndex, OUT INT *IntegerValue)
Definition: infsupp.c:146
GLuint res
Definition: glext.h:9613
#define CSIDL_SYSTEM
Definition: shlobj.h:2039
GLfloat GLfloat p
Definition: glext.h:8902
WCHAR * LPWSTR
Definition: xmlstorage.h:184
static VOID FatalError(char *pszFmt,...)
Definition: install.c:43
BOOL WINAPI SetupGetStringFieldW(IN PINFCONTEXT Context, IN ULONG FieldIndex, OUT PWSTR ReturnBuffer, IN ULONG ReturnBufferSize, OUT PULONG RequiredSize)
Definition: infsupp.c:184

Referenced by InstallLiveCD(), and RegistrationProc().

◆ SetAdministratorPassword()

NTSTATUS SetAdministratorPassword ( LPCWSTR  Password)

Definition at line 620 of file security.c.

621 {
623  PUSER_ACCOUNT_NAME_INFORMATION AccountNameInfo = NULL;
624  USER_SET_PASSWORD_INFORMATION PasswordInfo;
626  LSA_HANDLE PolicyHandle = NULL;
627  SAM_HANDLE ServerHandle = NULL;
628  SAM_HANDLE DomainHandle = NULL;
629  SAM_HANDLE UserHandle = NULL;
631 
632  DPRINT("SYSSETUP: SetAdministratorPassword(%p)\n", Password);
633 
636 
640  &PolicyHandle);
641  if (Status != STATUS_SUCCESS)
642  {
643  DPRINT1("LsaOpenPolicy() failed (Status: 0x%08lx)\n", Status);
644  return Status;
645  }
646 
647  Status = LsaQueryInformationPolicy(PolicyHandle,
649  (PVOID *)&OrigInfo);
650  if (!NT_SUCCESS(Status))
651  {
652  DPRINT1("LsaQueryInformationPolicy() failed (Status: 0x%08lx)\n", Status);
653  goto done;
654  }
655 
657  &ServerHandle,
659  NULL);
660  if (!NT_SUCCESS(Status))
661  {
662  DPRINT1("SamConnect() failed (Status: 0x%08lx)\n", Status);
663  goto done;
664  }
665 
666  Status = SamOpenDomain(ServerHandle,
668  OrigInfo->DomainSid,
669  &DomainHandle);
670  if (!NT_SUCCESS(Status))
671  {
672  DPRINT1("SamOpenDomain() failed (Status: 0x%08lx)\n", Status);
673  goto done;
674  }
675 
676  Status = SamOpenUser(DomainHandle,
679  &UserHandle);
680  if (!NT_SUCCESS(Status))
681  {
682  DPRINT1("SamOpenUser() failed (Status %08lx)\n", Status);
683  goto done;
684  }
685 
686  RtlInitUnicodeString(&PasswordInfo.Password, Password);
687  PasswordInfo.PasswordExpired = FALSE;
688 
689  Status = SamSetInformationUser(UserHandle,
691  (PVOID)&PasswordInfo);
692  if (!NT_SUCCESS(Status))
693  {
694  DPRINT1("SamSetInformationUser() failed (Status %08lx)\n", Status);
695  goto done;
696  }
697 
698  Status = SamQueryInformationUser(UserHandle,
700  (PVOID*)&AccountNameInfo);
701  if (!NT_SUCCESS(Status))
702  {
703  DPRINT1("SamSetInformationUser() failed (Status %08lx)\n", Status);
704  goto done;
705  }
706 
707  AdminInfo.Name = RtlAllocateHeap(RtlGetProcessHeap(),
709  AccountNameInfo->UserName.Length + sizeof(WCHAR));
710  if (AdminInfo.Name != NULL)
712  AccountNameInfo->UserName.Buffer,
713  AccountNameInfo->UserName.Length);
714 
715  AdminInfo.Domain = RtlAllocateHeap(RtlGetProcessHeap(),
717  OrigInfo->DomainName.Length + sizeof(WCHAR));
718  if (AdminInfo.Domain != NULL)
720  OrigInfo->DomainName.Buffer,
721  OrigInfo->DomainName.Length);
722 
723  AdminInfo.Password = RtlAllocateHeap(RtlGetProcessHeap(),
724  0,
725  (wcslen(Password) + 1) * sizeof(WCHAR));
726  if (AdminInfo.Password != NULL)
728 
729  DPRINT("Administrator Name: %S\n", AdminInfo.Name);
730  DPRINT("Administrator Domain: %S\n", AdminInfo.Domain);
731  DPRINT("Administrator Password: %S\n", AdminInfo.Password);
732 
733 done:
734  if (AccountNameInfo != NULL)
735  SamFreeMemory(AccountNameInfo);
736 
737  if (OrigInfo != NULL)
738  LsaFreeMemory(OrigInfo);
739 
740  if (PolicyHandle != NULL)
741  LsaClose(PolicyHandle);
742 
743  if (UserHandle != NULL)
744  SamCloseHandle(UserHandle);
745 
746  if (DomainHandle != NULL)
747  SamCloseHandle(DomainHandle);
748 
749  if (ServerHandle != NULL)
750  SamCloseHandle(ServerHandle);
751 
752  DPRINT1("SYSSETUP: SetAdministratorPassword() done (Status %08lx)\n", Status);
753 
754  return Status;
755 }
NTSTATUS NTAPI SamCloseHandle(IN SAM_HANDLE SamHandle)
Definition: samlib.c:476
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
#define SAM_SERVER_CONNECT
Definition: ntsam.h:99
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
NTSTATUS WINAPI LsaQueryInformationPolicy(IN LSA_HANDLE PolicyHandle, IN POLICY_INFORMATION_CLASS InformationClass, OUT PVOID *Buffer)
Definition: lsa.c:1471
#define POLICY_VIEW_LOCAL_INFORMATION
Definition: ntsecapi.h:61
ADMIN_INFO AdminInfo
Definition: install.c:38
NTSTATUS NTAPI SamOpenDomain(IN SAM_HANDLE ServerHandle, IN ACCESS_MASK DesiredAccess, IN PSID DomainId, OUT PSAM_HANDLE DomainHandle)
Definition: samlib.c:1441
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS WINAPI LsaClose(IN LSA_HANDLE ObjectHandle)
Definition: lsa.c:192
LPWSTR Name
Definition: globals.h:23
UNICODE_STRING UserName
Definition: ntsam.h:595
NTSTATUS WINAPI LsaOpenPolicy(IN PLSA_UNICODE_STRING SystemName OPTIONAL, IN PLSA_OBJECT_ATTRIBUTES ObjectAttributes, IN ACCESS_MASK DesiredAccess, OUT PLSA_HANDLE PolicyHandle)
Definition: lsa.c:1181
#define USER_READ_GENERAL
Definition: ntsam.h:126
#define DOMAIN_USER_RID_ADMIN
Definition: setypes.h:603
#define USER_FORCE_PASSWORD_CHANGE
Definition: ntsam.h:133
UNICODE_STRING Password
Definition: ntsam.h:636
smooth NULL
Definition: ftsmooth.c:416
#define SAM_SERVER_LOOKUP_DOMAIN
Definition: ntsam.h:104
void DPRINT(...)
Definition: polytest.cpp:61
NTSTATUS WINAPI LsaFreeMemory(IN PVOID Buffer)
Definition: lsa.c:699
NTSTATUS NTAPI SamSetInformationUser(IN SAM_HANDLE UserHandle, IN USER_INFORMATION_CLASS UserInformationClass, IN PVOID Buffer)
Definition: samlib.c:1964
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:585
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define POLICY_TRUST_ADMIN
Definition: ntsecapi.h:64
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
NTSTATUS NTAPI SamFreeMemory(IN PVOID Buffer)
Definition: samlib.c:947
LPWSTR Password
Definition: globals.h:25
struct _LSA_OBJECT_ATTRIBUTES LSA_OBJECT_ATTRIBUTES
Status
Definition: gdiplustypes.h:24
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
LSA_UNICODE_STRING DomainName
Definition: ntsecapi.h:563
#define DPRINT1
Definition: precomp.h:8
LPWSTR Domain
Definition: globals.h:24
#define DOMAIN_LOOKUP
Definition: ntsam.h:42
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSTATUS NTAPI SamQueryInformationUser(IN SAM_HANDLE UserHandle, IN USER_INFORMATION_CLASS UserInformationClass, OUT PVOID *Buffer)
Definition: samlib.c:1695
return STATUS_SUCCESS
Definition: btrfs.c:2725
#define memset(x, y, z)
Definition: compat.h:39
NTSTATUS NTAPI SamConnect(IN OUT PUNICODE_STRING ServerName OPTIONAL, OUT PSAM_HANDLE ServerHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: samlib.c:498
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
NTSTATUS NTAPI SamOpenUser(IN SAM_HANDLE DomainHandle, IN ACCESS_MASK DesiredAccess, IN ULONG UserId, OUT PSAM_HANDLE UserHandle)
Definition: samlib.c:1499

Referenced by ComputerPageDlgProc().

◆ SetAutoAdminLogon()

VOID SetAutoAdminLogon ( VOID  )

Definition at line 759 of file security.c.

760 {
761  WCHAR szAutoAdminLogon[2];
762  HKEY hKey = NULL;
763  DWORD dwType;
764  DWORD dwSize;
765  LONG lError;
766 
768  L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon",
769  0,
771  &hKey);
772  if (lError != ERROR_SUCCESS)
773  return;
774 
775  dwSize = 2 * sizeof(WCHAR);
776  lError = RegQueryValueExW(hKey,
777  L"AutoAdminLogon",
778  NULL,
779  &dwType,
780  (LPBYTE)szAutoAdminLogon,
781  &dwSize);
782  if (lError != ERROR_SUCCESS)
783  goto done;
784 
785  if (wcscmp(szAutoAdminLogon, L"1") == 0)
786  {
787  RegSetValueExW(hKey,
788  L"DefaultDomainName",
789  0,
790  REG_SZ,
792  (wcslen(AdminInfo.Domain) + 1) * sizeof(WCHAR));
793 
794  RegSetValueExW(hKey,
795  L"DefaultUserName",
796  0,
797  REG_SZ,
799  (wcslen(AdminInfo.Name) + 1) * sizeof(WCHAR));
800 
801  RegSetValueExW(hKey,
802  L"DefaultPassword",
803  0,
804  REG_SZ,
806  (wcslen(AdminInfo.Password) + 1) * sizeof(WCHAR));
807  }
808 
809 done:
810  if (hKey != NULL)
811  RegCloseKey(hKey);
812 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_READ
Definition: nt_native.h:1023
ADMIN_INFO AdminInfo
Definition: install.c:38
LPWSTR Name
Definition: globals.h:23
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
#define KEY_WRITE
Definition: nt_native.h:1031
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4917
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4134
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
LPWSTR Password
Definition: globals.h:25
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
LPWSTR Domain
Definition: globals.h:24
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define REG_SZ
Definition: layer.c:22

Referenced by InstallReactOS().

Variable Documentation

◆ AdminInfo

ADMIN_INFO AdminInfo

Definition at line 38 of file install.c.

Referenced by InstallReactOS(), SetAdministratorPassword(), and SetAutoAdminLogon().

◆ hDllInstance

HINSTANCE hDllInstance

Definition at line 34 of file acledit.c.

◆ hSysSetupInf