Indentation clean-up. No code changes.
authorEric Kohl <eric.kohl@reactos.org>
Sun, 16 Sep 2007 13:38:26 +0000 (13:38 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Sun, 16 Sep 2007 13:38:26 +0000 (13:38 +0000)
svn path=/trunk/; revision=29067

reactos/dll/cpl/appwiz/appwiz.c
reactos/dll/cpl/hdwwiz/hdwwiz.c
reactos/dll/cpl/liccpa/liccpa.c

index 2927f75..11b397e 100644 (file)
@@ -19,7 +19,7 @@
 /* $Id$
  *
  * PROJECT:         ReactOS Software Control Panel
- * FILE:            lib/cpl/system/appwiz.c
+ * FILE:            dll/cpl/appwiz/appwiz.c
  * PURPOSE:         ReactOS Software Control Panel
  * PROGRAMMER:      Gero Kuehn (reactos.filter@gkware.com)
  * UPDATE HISTORY:
@@ -49,214 +49,221 @@ HINSTANCE hApplet = 0;
 /* Applets */
 APPLET Applets[NUM_APPLETS] = 
 {
-  {IDI_CPLSYSTEM, IDS_CPLSYSTEMNAME, IDS_CPLSYSTEMDESCRIPTION, SystemApplet}
+    {IDI_CPLSYSTEM, IDS_CPLSYSTEMNAME, IDS_CPLSYSTEMDESCRIPTION, SystemApplet}
 };
 
 
 static VOID
 CallUninstall(HWND hwndDlg)
 {
-  STARTUPINFO si;
-  PROCESS_INFORMATION pi;
-  int nIndex;
-  HKEY hKey;
-  DWORD dwType;
-  TCHAR pszUninstallString[MAX_PATH];
-  DWORD dwSize;
-
-  nIndex = (int) SendDlgItemMessage(hwndDlg, IDC_SOFTWARELIST, LB_GETCURSEL, 0, 0);
-  if (nIndex == -1)
-  {
-    MessageBox(hwndDlg,
-               _TEXT("No item selected"),
-               _TEXT("Error"),
-               MB_ICONSTOP);
-  }
-  else
-  {
-    hKey = (HKEY)SendDlgItemMessage(hwndDlg, IDC_SOFTWARELIST, LB_GETITEMDATA, (WPARAM)nIndex, 0);
-
-    dwType = REG_SZ;
-    dwSize = MAX_PATH;
-    if (RegQueryValueEx(hKey,
-                        _TEXT("UninstallString"),
-                        NULL,
-                        &dwType,
-                        (LPBYTE)pszUninstallString,
-                        &dwSize) == ERROR_SUCCESS)
+    STARTUPINFO si;
+    PROCESS_INFORMATION pi;
+    INT nIndex;
+    HKEY hKey;
+    DWORD dwType;
+    TCHAR pszUninstallString[MAX_PATH];
+    DWORD dwSize;
+
+    nIndex = (INT)SendDlgItemMessage(hwndDlg, IDC_SOFTWARELIST, LB_GETCURSEL, 0, 0);
+    if (nIndex == -1)
     {
-      ZeroMemory(&si, sizeof(si));
-      si.cb = sizeof(si);
-      si.wShowWindow = SW_SHOW;
-      if (CreateProcess(NULL,pszUninstallString,NULL,NULL,FALSE,0,NULL,NULL,&si,&pi))
-      {
-        CloseHandle(pi.hProcess);
-        CloseHandle(pi.hThread);
-      }
+        MessageBox(hwndDlg,
+                   _TEXT("No item selected"),
+                   _TEXT("Error"),
+                   MB_ICONSTOP);
     }
     else
     {
-      MessageBox(hwndDlg,
-                 _TEXT("Unable to read UninstallString. This entry is invalid or has been created by an MSI installer."),
-                 _TEXT("Error"),
-                 MB_ICONSTOP);
+        hKey = (HKEY)SendDlgItemMessage(hwndDlg, IDC_SOFTWARELIST, LB_GETITEMDATA, (WPARAM)nIndex, 0);
+
+        dwType = REG_SZ;
+        dwSize = MAX_PATH;
+        if (RegQueryValueEx(hKey,
+                            _TEXT("UninstallString"),
+                            NULL,
+                            &dwType,
+                            (LPBYTE)pszUninstallString,
+                            &dwSize) == ERROR_SUCCESS)
+        {
+            ZeroMemory(&si, sizeof(si));
+            si.cb = sizeof(si);
+            si.wShowWindow = SW_SHOW;
+            if (CreateProcess(NULL,pszUninstallString,NULL,NULL,FALSE,0,NULL,NULL,&si,&pi))
+            {
+                CloseHandle(pi.hProcess);
+                CloseHandle(pi.hThread);
+            }
+        }
+        else
+        {
+            MessageBox(hwndDlg,
+                       _TEXT("Unable to read UninstallString. This entry is invalid or has been created by an MSI installer."),
+                       _TEXT("Error"),
+                       MB_ICONSTOP);
+        }
     }
-  }
 }
 
 
-static void FillSoftwareList(HWND hwndDlg)
+static VOID
+FillSoftwareList(HWND hwndDlg)
 {
-  TCHAR pszName[MAX_PATH];
-  TCHAR pszDisplayName[MAX_PATH];
-  TCHAR pszParentKeyName[MAX_PATH];
-  FILETIME FileTime;
-  HKEY hKey;
-  HKEY hSubKey;
-  DWORD dwType;
-  DWORD dwSize;
-  DWORD dwValue = 0;
-  BOOL bIsUpdate = FALSE;
-  BOOL bIsSystemComponent = FALSE;
-  BOOL bShowUpdates = FALSE;
-  int i;
-  ULONG index;
-
-  bShowUpdates = (SendMessage(GetDlgItem(hwndDlg, IDC_SHOWUPDATES), BM_GETCHECK, 0, 0) == BST_CHECKED);
-
-  if (RegOpenKey(HKEY_LOCAL_MACHINE,
-                 _TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall"),
-                 &hKey) != ERROR_SUCCESS)
-  {
-    MessageBox(hwndDlg,
-               _TEXT("Unable to open Uninstall Key"),
-               _TEXT("Error"),
-               MB_ICONSTOP);
-    return;
-  }
-
-  i = 0;
-  dwSize = MAX_PATH;
-  while (RegEnumKeyEx (hKey, i, pszName, &dwSize, NULL, NULL, NULL, &FileTime) == ERROR_SUCCESS)
-  {
-    if (RegOpenKey(hKey,pszName,&hSubKey)==ERROR_SUCCESS)
+    TCHAR pszName[MAX_PATH];
+    TCHAR pszDisplayName[MAX_PATH];
+    TCHAR pszParentKeyName[MAX_PATH];
+    FILETIME FileTime;
+    HKEY hKey;
+    HKEY hSubKey;
+    DWORD dwType;
+    DWORD dwSize;
+    DWORD dwValue = 0;
+    BOOL bIsUpdate = FALSE;
+    BOOL bIsSystemComponent = FALSE;
+    BOOL bShowUpdates = FALSE;
+    INT i;
+    ULONG ulIndex;
+
+    bShowUpdates = (SendMessage(GetDlgItem(hwndDlg, IDC_SHOWUPDATES), BM_GETCHECK, 0, 0) == BST_CHECKED);
+
+    if (RegOpenKey(HKEY_LOCAL_MACHINE,
+                   _TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall"),
+                   &hKey) != ERROR_SUCCESS)
     {
-      dwType = REG_DWORD;
-      dwSize = sizeof(DWORD);
-      if (RegQueryValueEx(hSubKey,
-                          _TEXT("SystemComponent"),
-                          NULL,
-                          &dwType,
-                          (LPBYTE)&dwValue,
-                          &dwSize) == ERROR_SUCCESS)
-      {
-        bIsSystemComponent = (dwValue == 0x1);
-      }
-      else {
-        bIsSystemComponent = FALSE;
-      }
-      dwType = REG_SZ;
-      dwSize = MAX_PATH;
-      bIsUpdate = (RegQueryValueEx(hSubKey,
-                          _TEXT("ParentKeyName"),
-                          NULL,
-                          &dwType,
-                          (LPBYTE)pszParentKeyName,
-                          &dwSize) == ERROR_SUCCESS);
-      dwSize = MAX_PATH;
-      if (RegQueryValueEx(hSubKey,
-                          _TEXT("DisplayName"),
-                          NULL,
-                          &dwType,
-                          (LPBYTE)pszDisplayName,
-                          &dwSize) == ERROR_SUCCESS)
-      {
-        if ((!bIsUpdate) && (!bIsSystemComponent))
-        {
-          index = (ULONG) SendDlgItemMessage(hwndDlg,IDC_SOFTWARELIST,LB_ADDSTRING,0,(LPARAM)pszDisplayName);
-          SendDlgItemMessage(hwndDlg,IDC_SOFTWARELIST,LB_SETITEMDATA,index,(LPARAM)hSubKey);
-        }
-        else if (bIsUpdate && bShowUpdates)
-        {
-          index = (ULONG) SendDlgItemMessage(hwndDlg,IDC_SOFTWARELIST,LB_ADDSTRING,0,(LPARAM)pszDisplayName);
-          SendDlgItemMessage(hwndDlg,IDC_SOFTWARELIST,LB_SETITEMDATA,index,(LPARAM)hSubKey);
-        }
-      }
+        MessageBox(hwndDlg,
+                   _TEXT("Unable to open Uninstall Key"),
+                   _TEXT("Error"),
+                   MB_ICONSTOP);
+        return;
     }
 
+    i = 0;
     dwSize = MAX_PATH;
-    i++;
-  }
+    while (RegEnumKeyEx (hKey, i, pszName, &dwSize, NULL, NULL, NULL, &FileTime) == ERROR_SUCCESS)
+    {
+        if (RegOpenKey(hKey,pszName,&hSubKey) == ERROR_SUCCESS)
+        {
+            dwType = REG_DWORD;
+            dwSize = sizeof(DWORD);
+            if (RegQueryValueEx(hSubKey,
+                                _TEXT("SystemComponent"),
+                                NULL,
+                                &dwType,
+                                (LPBYTE)&dwValue,
+                                &dwSize) == ERROR_SUCCESS)
+            {
+                bIsSystemComponent = (dwValue == 0x1);
+            }
+            else
+            {
+                bIsSystemComponent = FALSE;
+            }
+
+            dwType = REG_SZ;
+            dwSize = MAX_PATH;
+            bIsUpdate = (RegQueryValueEx(hSubKey,
+                                         _TEXT("ParentKeyName"),
+                                         NULL,
+                                         &dwType,
+                                         (LPBYTE)pszParentKeyName,
+                                         &dwSize) == ERROR_SUCCESS);
+            dwSize = MAX_PATH;
+            if (RegQueryValueEx(hSubKey,
+                                _TEXT("DisplayName"),
+                                NULL,
+                                &dwType,
+                                (LPBYTE)pszDisplayName,
+                                &dwSize) == ERROR_SUCCESS)
+            {
+                if ((!bIsUpdate) && (!bIsSystemComponent))
+                {
+                    ulIndex = (ULONG)SendDlgItemMessage(hwndDlg,IDC_SOFTWARELIST,LB_ADDSTRING,0,(LPARAM)pszDisplayName);
+                    SendDlgItemMessage(hwndDlg,IDC_SOFTWARELIST,LB_SETITEMDATA,ulIndex,(LPARAM)hSubKey);
+                }
+                else if (bIsUpdate && bShowUpdates)
+                {
+                    ulIndex = (ULONG)SendDlgItemMessage(hwndDlg,IDC_SOFTWARELIST,LB_ADDSTRING,0,(LPARAM)pszDisplayName);
+                    SendDlgItemMessage(hwndDlg,IDC_SOFTWARELIST,LB_SETITEMDATA,ulIndex,(LPARAM)hSubKey);
+                }
+            }
+        }
 
-  RegCloseKey(hKey);
+        dwSize = MAX_PATH;
+        i++;
+    }
+
+    RegCloseKey(hKey);
 }
 
+
 /* Property page dialog callback */
 static INT_PTR CALLBACK
-InstallPageProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
+InstallPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 {
-  UNREFERENCED_PARAMETER(lParam);
-  switch (uMsg)
-  {
-    case WM_INITDIALOG:
-      EnableWindow(GetDlgItem(hwndDlg,IDC_INSTALL), FALSE);
-      FillSoftwareList(hwndDlg);
-      break;
-
-    case WM_COMMAND:
-      switch (LOWORD(wParam))
-      {
-        case IDC_SHOWUPDATES:
-          if (HIWORD(wParam) == BN_CLICKED)
-          {
-            SendDlgItemMessage(hwndDlg, IDC_SOFTWARELIST, LB_RESETCONTENT, 0, 0);
+    UNREFERENCED_PARAMETER(lParam);
+
+    switch (uMsg)
+    {
+        case WM_INITDIALOG:
+            EnableWindow(GetDlgItem(hwndDlg, IDC_INSTALL), FALSE);
             FillSoftwareList(hwndDlg);
-          }
-          break;
-        case IDC_SOFTWARELIST:
-          if (HIWORD(wParam) == LBN_DBLCLK)
-          {
-            CallUninstall(hwndDlg);
-          }
-          break;
-
-        case IDC_ADDREMOVE:
-          CallUninstall(hwndDlg);
-          break;
-      }
-      break;
-  }
-
-  return FALSE;
+            break;
+
+        case WM_COMMAND:
+            switch (LOWORD(wParam))
+            {
+                case IDC_SHOWUPDATES:
+                    if (HIWORD(wParam) == BN_CLICKED)
+                    {
+                        SendDlgItemMessage(hwndDlg, IDC_SOFTWARELIST, LB_RESETCONTENT, 0, 0);
+                        FillSoftwareList(hwndDlg);
+                    }
+                    break;
+
+                case IDC_SOFTWARELIST:
+                    if (HIWORD(wParam) == LBN_DBLCLK)
+                    {
+                        CallUninstall(hwndDlg);
+                    }
+                    break;
+
+                case IDC_ADDREMOVE:
+                    CallUninstall(hwndDlg);
+                    break;
+            }
+            break;
+    }
+
+    return FALSE;
 }
 
 
 /* Property page dialog callback */
 static INT_PTR CALLBACK
-RosPageProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
+RosPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 {
-  UNREFERENCED_PARAMETER(lParam);
-  UNREFERENCED_PARAMETER(wParam);
-  UNREFERENCED_PARAMETER(hwndDlg);
-  switch(uMsg)
-  {
-    case WM_INITDIALOG:
-      break;
-  }
-
-  return FALSE;
+    UNREFERENCED_PARAMETER(lParam);
+    UNREFERENCED_PARAMETER(wParam);
+    UNREFERENCED_PARAMETER(hwndDlg);
+
+    switch (uMsg)
+    {
+        case WM_INITDIALOG:
+            break;
+    }
+
+    return FALSE;
 }
 
 
 static VOID
 InitPropSheetPage(PROPSHEETPAGE *psp, WORD idDlg, DLGPROC DlgProc)
 {
-  ZeroMemory(psp, sizeof(PROPSHEETPAGE));
-  psp->dwSize = sizeof(PROPSHEETPAGE);
-  psp->dwFlags = PSP_DEFAULT;
-  psp->hInstance = hApplet;
-  psp->pszTemplate = MAKEINTRESOURCE(idDlg);
-  psp->pfnDlgProc = DlgProc;
+    ZeroMemory(psp, sizeof(PROPSHEETPAGE));
+    psp->dwSize = sizeof(PROPSHEETPAGE);
+    psp->dwFlags = PSP_DEFAULT;
+    psp->hInstance = hApplet;
+    psp->pszTemplate = MAKEINTRESOURCE(idDlg);
+    psp->pfnDlgProc = DlgProc;
 }
 
 
@@ -265,28 +272,28 @@ InitPropSheetPage(PROPSHEETPAGE *psp, WORD idDlg, DLGPROC DlgProc)
 LONG CALLBACK
 SystemApplet(VOID)
 {
-  PROPSHEETPAGE psp[2];
-  PROPSHEETHEADER psh;
-  TCHAR Caption[1024];
-
-  LoadString(hApplet, IDS_CPLSYSTEMNAME, Caption, sizeof(Caption) / sizeof(TCHAR));
-
-  ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
-  psh.dwSize = sizeof(PROPSHEETHEADER);
-  psh.dwFlags =  PSH_PROPSHEETPAGE;
-  psh.hwndParent = NULL;
-  psh.hInstance = hApplet;
-  psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDI_CPLSYSTEM));
-  psh.pszCaption = Caption;
-  psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
-  psh.nStartPage = 0;
-  psh.ppsp = psp;
-  psh.pfnCallback = NULL;
-
-  InitPropSheetPage(&psp[0], IDD_PROPPAGEINSTALL, (DLGPROC) InstallPageProc);
-  InitPropSheetPage(&psp[1], IDD_PROPPAGEROSSETUP, (DLGPROC) RosPageProc);
-
-  return (LONG)(PropertySheet(&psh) != -1);
+    PROPSHEETPAGE psp[2];
+    PROPSHEETHEADER psh;
+    TCHAR Caption[1024];
+
+    LoadString(hApplet, IDS_CPLSYSTEMNAME, Caption, sizeof(Caption) / sizeof(TCHAR));
+
+    ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
+    psh.dwSize = sizeof(PROPSHEETHEADER);
+    psh.dwFlags =  PSH_PROPSHEETPAGE;
+    psh.hwndParent = NULL;
+    psh.hInstance = hApplet;
+    psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDI_CPLSYSTEM));
+    psh.pszCaption = Caption;
+    psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
+    psh.nStartPage = 0;
+    psh.ppsp = psp;
+    psh.pfnCallback = NULL;
+
+    InitPropSheetPage(&psp[0], IDD_PROPPAGEINSTALL, (DLGPROC) InstallPageProc);
+    InitPropSheetPage(&psp[1], IDD_PROPPAGEROSSETUP, (DLGPROC) RosPageProc);
+
+    return (LONG)(PropertySheet(&psh) != -1);
 }
 
 
@@ -294,47 +301,49 @@ SystemApplet(VOID)
 LONG CALLBACK
 CPlApplet(HWND hwndCPl, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
 {
-  CPLINFO *CPlInfo;
-  DWORD i;
-
-  UNREFERENCED_PARAMETER(hwndCPl);
-
-  i = (DWORD)lParam1;
-  switch(uMsg)
-  {
-    case CPL_INIT:
-      return TRUE;
-
-    case CPL_GETCOUNT:
-      return NUM_APPLETS;
-
-    case CPL_INQUIRE:
-      CPlInfo = (CPLINFO*)lParam2;
-      CPlInfo->lData = 0;
-      CPlInfo->idIcon = Applets[i].idIcon;
-      CPlInfo->idName = Applets[i].idName;
-      CPlInfo->idInfo = Applets[i].idDescription;
-      break;
-
-    case CPL_DBLCLK:
-      Applets[i].AppletProc();
-      break;
-  }
-
-  return FALSE;
+    CPLINFO *CPlInfo;
+    DWORD i;
+
+    UNREFERENCED_PARAMETER(hwndCPl);
+
+    i = (DWORD)lParam1;
+    switch (uMsg)
+    {
+        case CPL_INIT:
+            return TRUE;
+
+        case CPL_GETCOUNT:
+            return NUM_APPLETS;
+
+        case CPL_INQUIRE:
+            CPlInfo = (CPLINFO*)lParam2;
+            CPlInfo->lData = 0;
+            CPlInfo->idIcon = Applets[i].idIcon;
+            CPlInfo->idName = Applets[i].idName;
+            CPlInfo->idInfo = Applets[i].idDescription;
+            break;
+
+        case CPL_DBLCLK:
+            Applets[i].AppletProc();
+            break;
+    }
+
+    return FALSE;
 }
 
 
 BOOL WINAPI
 DllMain(HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpvReserved)
 {
-  UNREFERENCED_PARAMETER(lpvReserved);
-  switch(dwReason)
-  {
-    case DLL_PROCESS_ATTACH:
-    case DLL_THREAD_ATTACH:
-      hApplet = hinstDLL;
-      break;
-  }
-  return TRUE;
+    UNREFERENCED_PARAMETER(lpvReserved);
+
+    switch (dwReason)
+    {
+        case DLL_PROCESS_ATTACH:
+        case DLL_THREAD_ATTACH:
+            hApplet = hinstDLL;
+            break;
+    }
+
+    return TRUE;
 }
index d25bb77..23e2e6d 100644 (file)
@@ -18,7 +18,7 @@
  */
 /*
  * PROJECT:         ReactOS Add hardware control panel
- * FILE:            lib/cpl/hdwwiz/hdwwiz.c
+ * FILE:            dll/cpl/hdwwiz/hdwwiz.c
  * PURPOSE:         ReactOS Add hardware control panel
  * PROGRAMMER:      HervĂ© Poussineau (hpoussin@reactos.org)
  */
@@ -39,7 +39,7 @@ HINSTANCE hApplet = 0;
 /* Applets */
 APPLET Applets[] = 
 {
-       {IDI_CPLICON, IDS_CPLNAME, IDS_CPLDESCRIPTION, Applet}
+    {IDI_CPLICON, IDS_CPLNAME, IDS_CPLDESCRIPTION, Applet}
 };
 
 typedef BOOL (WINAPI *PINSTALL_NEW_DEVICE)(HWND, LPGUID, PDWORD);
@@ -47,105 +47,108 @@ typedef BOOL (WINAPI *PINSTALL_NEW_DEVICE)(HWND, LPGUID, PDWORD);
 static LONG APIENTRY
 Applet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
 {
-       HMODULE hNewDev = NULL;
-       PINSTALL_NEW_DEVICE InstallNewDevice;
-       DWORD Reboot;
-       BOOL ret;
-       LONG rc;
-
-       UNREFERENCED_PARAMETER(lParam);
-       UNREFERENCED_PARAMETER(wParam);
-       UNREFERENCED_PARAMETER(uMsg);
-
-       hNewDev = LoadLibrary(_T("newdev.dll"));
-       if (!hNewDev)
-       {
-               rc = 1;
-               goto cleanup;
-       }
-
-       InstallNewDevice = (PINSTALL_NEW_DEVICE)GetProcAddress(hNewDev, (LPCSTR)"InstallNewDevice");
-       if (!InstallNewDevice)
-       {
-               rc = 2;
-               goto cleanup;
-       }
-
-       ret = InstallNewDevice(hwnd, NULL, &Reboot);
-       if (!ret)
-       {
-               rc = 3;
-               goto cleanup;
-       }
-
-       if (Reboot != DI_NEEDRESTART && Reboot != DI_NEEDREBOOT)
-       {
-               /* We're done with installation */
-               rc = 0;
-               goto cleanup;
-       }
-
-       /* We need to reboot */
-       if (SetupPromptReboot(NULL, hwnd, FALSE) == -1)
-       {
-               /* User doesn't want to reboot, or an error occurred */
-               rc = 5;
-               goto cleanup;
-       }
-
-       rc = 0;
+    HMODULE hNewDev = NULL;
+    PINSTALL_NEW_DEVICE InstallNewDevice;
+    DWORD Reboot;
+    BOOL ret;
+    LONG rc;
+
+    UNREFERENCED_PARAMETER(lParam);
+    UNREFERENCED_PARAMETER(wParam);
+    UNREFERENCED_PARAMETER(uMsg);
+
+    hNewDev = LoadLibrary(_T("newdev.dll"));
+    if (!hNewDev)
+    {
+        rc = 1;
+        goto cleanup;
+    }
+
+    InstallNewDevice = (PINSTALL_NEW_DEVICE)GetProcAddress(hNewDev, (LPCSTR)"InstallNewDevice");
+    if (!InstallNewDevice)
+    {
+        rc = 2;
+        goto cleanup;
+    }
+
+    ret = InstallNewDevice(hwnd, NULL, &Reboot);
+    if (!ret)
+    {
+        rc = 3;
+        goto cleanup;
+    }
+
+    if (Reboot != DI_NEEDRESTART && Reboot != DI_NEEDREBOOT)
+    {
+        /* We're done with installation */
+        rc = 0;
+        goto cleanup;
+    }
+
+    /* We need to reboot */
+    if (SetupPromptReboot(NULL, hwnd, FALSE) == -1)
+    {
+        /* User doesn't want to reboot, or an error occurred */
+        rc = 5;
+        goto cleanup;
+    }
+
+    rc = 0;
 
 cleanup:
-       if (hNewDev != NULL)
-               FreeLibrary(hNewDev);
-       return rc;
+    if (hNewDev != NULL)
+        FreeLibrary(hNewDev);
+    return rc;
 }
 
+
 /* Control Panel Callback */
 LONG CALLBACK
 CPlApplet(HWND hwndCpl,
-       UINT uMsg,
-       LPARAM lParam1,
-       LPARAM lParam2)
+          UINT uMsg,
+          LPARAM lParam1,
+          LPARAM lParam2)
 {
-       int i = (int)lParam1;
-
-       switch (uMsg)
-       {
-               case CPL_INIT:
-                       return TRUE;
-
-               case CPL_GETCOUNT:
-                       return sizeof(Applets)/sizeof(Applets[0]);
-
-               case CPL_INQUIRE:
-               {
-                       CPLINFO *CPlInfo = (CPLINFO*)lParam2;
-                       CPlInfo->lData = 0;
-                       CPlInfo->idIcon = Applets[i].idIcon;
-                       CPlInfo->idName = Applets[i].idName;
-                       CPlInfo->idInfo = Applets[i].idDescription;
-                       break;
-               }
-
-               case CPL_DBLCLK:
-               {
-                       Applets[i].AppletProc(hwndCpl, uMsg, lParam1, lParam2);
-                       break;
-               }
-       }
-       return FALSE;
+    INT i = (INT)lParam1;
+
+    switch (uMsg)
+    {
+        case CPL_INIT:
+            return TRUE;
+
+        case CPL_GETCOUNT:
+            return sizeof(Applets)/sizeof(Applets[0]);
+
+        case CPL_INQUIRE:
+            {
+                CPLINFO *CPlInfo = (CPLINFO*)lParam2;
+                CPlInfo->lData = 0;
+                CPlInfo->idIcon = Applets[i].idIcon;
+                CPlInfo->idName = Applets[i].idName;
+                CPlInfo->idInfo = Applets[i].idDescription;
+            }
+            break;
+
+        case CPL_DBLCLK:
+            Applets[i].AppletProc(hwndCpl, uMsg, lParam1, lParam2);
+            break;
+    }
+
+    return FALSE;
 }
 
+
 BOOL WINAPI
 DllMain(HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpvReserved)
 {
-       UNREFERENCED_PARAMETER(lpvReserved);
-       switch(dwReason)
-       {
-               case DLL_PROCESS_ATTACH:
-                       hApplet = hinstDLL;
-                       break;
-       }
-       return TRUE;
+    UNREFERENCED_PARAMETER(lpvReserved);
+
+    switch (dwReason)
+    {
+        case DLL_PROCESS_ATTACH:
+            hApplet = hinstDLL;
+            break;
+    }
+
+    return TRUE;
 }
index dc2440c..a5b9438 100644 (file)
@@ -2,7 +2,7 @@
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS License Manager
- * FILE:            lib/cpl/liccpa
+ * FILE:            dll/cpl/liccpa/liccpa.c
  * PURPOSE:         License Manager GUI
  * 
  * PROGRAMMERS:     Steven Edwards (steven_ed4153@yahoo.com)
 
 HINSTANCE hApplet = 0;
 
+
 INT_PTR CALLBACK
-DlgMainProc(
-  HWND hwndDlg,
-  UINT uMsg,
-  WPARAM wParam,
-  LPARAM lParam
-)
+DlgMainProc(HWND hwndDlg,
+            UINT uMsg,
+            WPARAM wParam,
+            LPARAM lParam)
 {
-  TCHAR szString[256];
-
-  switch(uMsg)
-  {
-    case WM_INITDIALOG:
-      break;
+    TCHAR szString[256];
 
-    case WM_COMMAND:
+    switch (uMsg)
     {
-      switch(HIWORD(wParam))
-      {
-        case LBN_DBLCLK:
-        {
-          switch(LOWORD(wParam))
-          {
-          }
-          break;
-        }
-        default:
-        {
-          switch(LOWORD(wParam))
-          {
-            case IDC_OK:
-            {
-              break;
-            }
-            case IDC_CANCEL:
+        case WM_INITDIALOG:
+            break;
+
+        case WM_COMMAND:
+            switch (HIWORD(wParam))
             {
-              EndDialog(hwndDlg, IDC_CANCEL);
-              break;
+                case LBN_DBLCLK:
+                    switch (LOWORD(wParam))
+                    {
+                    }
+                    break;
+
+                default:
+                    switch (LOWORD(wParam))
+                    {
+                        case IDC_OK:
+                            break;
+
+                        case IDC_CANCEL:
+                            EndDialog(hwndDlg, IDC_CANCEL);
+                            break;
+                    }
+                    break;
             }
-          }
-          break;
-        }
-      }
-      break;
-    }
-    case WM_CLOSE:
-    {
-      EndDialog(hwndDlg, IDC_CANCEL);
-      return TRUE;
+            break;
+
+        case WM_CLOSE:
+            EndDialog(hwndDlg, IDC_CANCEL);
+            return TRUE;
     }
-  }
-  return FALSE;
+
+    return FALSE;
 }
 
+
 LONG CALLBACK
-CPlApplet(
-       HWND hwndCPl,
-       UINT uMsg,
-       LPARAM lParam1,
-       LPARAM lParam2)
+CPlApplet(HWND hwndCPl,
+          UINT uMsg,
+          LPARAM lParam1,
+          LPARAM lParam2)
 {
-  switch(uMsg)
-  {
-    case CPL_INIT:
-    {
-      return TRUE;
-    }
-    case CPL_GETCOUNT:
+    switch (uMsg)
     {
-      return 1;
-    }
-    case CPL_INQUIRE:
-    {
-      CPLINFO *CPlInfo = (CPLINFO*)lParam2;
-      CPlInfo->lData = 0;
-      CPlInfo->idIcon = IDC_CPLICON_1;
-      CPlInfo->idName = IDS_CPLNAME_1;
-      CPlInfo->idInfo = IDS_CPLDESCRIPTION_1;
-      break;
-    }
-    case CPL_DBLCLK:
-    {
-      DialogBoxParam(hApplet, MAKEINTRESOURCE(IDD_PROPPAGE1), hwndCPl, DlgMainProc, WM_INITDIALOG);
-      break;
+        case CPL_INIT:
+            return TRUE;
+
+        case CPL_GETCOUNT:
+            return 1;
+
+        case CPL_INQUIRE:
+            {
+                CPLINFO *CPlInfo = (CPLINFO*)lParam2;
+                CPlInfo->lData = 0;
+                CPlInfo->idIcon = IDC_CPLICON_1;
+                CPlInfo->idName = IDS_CPLNAME_1;
+                CPlInfo->idInfo = IDS_CPLDESCRIPTION_1;
+            }
+            break;
+
+        case CPL_DBLCLK:
+            DialogBox(hApplet, MAKEINTRESOURCE(IDD_PROPPAGE1), NULL, DlgMainProc);
+            break;
     }
-  }
-  return FALSE;
+
+    return FALSE;
 }
 
 
 BOOL STDCALL
-DllMain(
-       HINSTANCE hinstDLL,
-       DWORD     dwReason,
-       LPVOID    lpvReserved)
+DllMain(HINSTANCE hinstDLL,
+        DWORD dwReason,
+        LPVOID lpvReserved)
 {
-  switch(dwReason)
-  {
-    case DLL_PROCESS_ATTACH:
-    case DLL_THREAD_ATTACH:
-      hApplet = hinstDLL;
-      break;
-  }
-  return TRUE;
+    switch (dwReason)
+    {
+        case DLL_PROCESS_ATTACH:
+        case DLL_THREAD_ATTACH:
+            hApplet = hinstDLL;
+            break;
+    }
+
+    return TRUE;
 }