Browse Source

Load system dlls from {sys}. Just some prep. Doesn't compile & untested.

Martijn Laan 9 years ago
parent
commit
96c253ef65

+ 1 - 1
Components/FolderTreeView.pas

@@ -1196,6 +1196,6 @@ end;
 
 
 initialization
 initialization
   InitThemeLibrary;
   InitThemeLibrary;
-  SHPathPrepareForWriteFunc := GetProcAddress(LoadLibrary(shell32),
+  SHPathPrepareForWriteFunc := GetProcAddress(LoadLibrary(PChar(AddBackslash(GetSystemDir) + shell32)),
     {$IFDEF UNICODE}'SHPathPrepareForWriteW'{$ELSE}'SHPathPrepareForWriteA'{$ENDIF});
     {$IFDEF UNICODE}'SHPathPrepareForWriteW'{$ELSE}'SHPathPrepareForWriteA'{$ENDIF});
 end.
 end.

+ 1 - 1
Components/NewCheckListBox.pas

@@ -357,7 +357,7 @@ var
   M: HMODULE;
   M: HMODULE;
 begin
 begin
   if not OleAccInited then begin
   if not OleAccInited then begin
-    M := LoadLibrary('oleacc.dll');
+    M := LoadLibrary(AddBackslash(GetSystemDir) + 'oleacc.dll');
     if M <> 0 then begin
     if M <> 0 then begin
       LresultFromObjectFunc := GetProcAddress(M, 'LresultFromObject');
       LresultFromObjectFunc := GetProcAddress(M, 'LresultFromObject');
       CreateStdAccessibleObjectFunc := GetProcAddress(M, 'CreateStdAccessibleObject');
       CreateStdAccessibleObjectFunc := GetProcAddress(M, 'CreateStdAccessibleObject');

+ 1 - 1
Components/RestartManager.pas

@@ -142,7 +142,7 @@ begin
   { Only attempt to load rstrtmgr.dll if running Windows Vista or later }
   { Only attempt to load rstrtmgr.dll if running Windows Vista or later }
   if (RestartManagerLibrary = 0) and (Lo(GetVersion) >= 6) then
   if (RestartManagerLibrary = 0) and (Lo(GetVersion) >= 6) then
   begin
   begin
-    RestartManagerLibrary := LoadLibrary(restartmanagerlib);
+    RestartManagerLibrary := LoadLibrary(PChar(AddBackslash(GetSystemDir) + restartmanagerlib));
     if RestartManagerLibrary <> 0 then
     if RestartManagerLibrary <> 0 then
     begin
     begin
       RmStartSession := GetProcAddress(RestartManagerLibrary, 'RmStartSession');
       RmStartSession := GetProcAddress(RestartManagerLibrary, 'RmStartSession');

+ 3 - 3
Components/RichEditViewer.pas

@@ -86,18 +86,18 @@ begin
   if RichEditUseCount = 0 then begin
   if RichEditUseCount = 0 then begin
     {$IFDEF UNICODE}
     {$IFDEF UNICODE}
     RichEditVersion := 4;
     RichEditVersion := 4;
-    RichEditModule := LoadLibrary('MSFTEDIT.DLL');
+    RichEditModule := LoadLibrary(PChar(AddBackslash(GetSystemDir) + 'MSFTEDIT.DLL'));
     {$ELSE}
     {$ELSE}
     RichEditModule := 0;
     RichEditModule := 0;
     {$ENDIF}
     {$ENDIF}
     if RichEditModule = 0 then begin
     if RichEditModule = 0 then begin
       RichEditVersion := 2;
       RichEditVersion := 2;
-      RichEditModule := LoadLibrary('RICHED20.DLL');
+      RichEditModule := LoadLibrary(PChar(AddBackslash(GetSystemDir) + 'RICHED20.DLL'));
     end;
     end;
     {$IFNDEF UNICODE}
     {$IFNDEF UNICODE}
     if RichEditModule = 0 then begin
     if RichEditModule = 0 then begin
       RichEditVersion := 1;
       RichEditVersion := 1;
-      RichEditModule := LoadLibrary('RICHED32.DLL');
+      RichEditModule := LoadLibrary(PChar(AddBackslash(GetSystemDir) + 'RICHED32.DLL'));
     end;
     end;
     {$ENDIF}
     {$ENDIF}
   end;
   end;

+ 1 - 1
Components/UxThemeISX.pas

@@ -1107,7 +1107,7 @@ begin
     not be located in the dynamic link library ntdll.dll" error message }
     not be located in the dynamic link library ntdll.dll" error message }
   if (ThemeLibrary = 0) and IsWindowsXP then
   if (ThemeLibrary = 0) and IsWindowsXP then
   begin
   begin
-    ThemeLibrary := LoadLibrary(themelib);
+    ThemeLibrary := LoadLibrary(PChar(AddBackslash(GetSystemDir) + themelib));
     if ThemeLibrary <> 0 then
     if ThemeLibrary <> 0 then
     begin
     begin
       OpenThemeData := GetProcAddress(ThemeLibrary, 'OpenThemeData');
       OpenThemeData := GetProcAddress(ThemeLibrary, 'OpenThemeData');

+ 1 - 1
Projects/CmnFunc2.pas

@@ -1669,7 +1669,7 @@ var
   M: HMODULE;
   M: HMODULE;
 begin
 begin
   if not SHAutoCompleteInitialized then begin
   if not SHAutoCompleteInitialized then begin
-    M := SafeLoadLibrary(PChar(AddBackslash(GetSystemDir) + 'shlwapi.dll'),
+    M := SafeLoadLibrary(AddBackslash(GetSystemDir) + 'shlwapi.dll'),
       SEM_NOOPENFILEERRORBOX);
       SEM_NOOPENFILEERRORBOX);
     if M <> 0 then
     if M <> 0 then
       SHAutoCompleteFunc := GetProcAddress(M, 'SHAutoComplete');
       SHAutoCompleteFunc := GetProcAddress(M, 'SHAutoComplete');

+ 1 - 1
Projects/HtmlHelpFunc.pas

@@ -54,7 +54,7 @@ var
 procedure InitHtmlHelpLibrary;
 procedure InitHtmlHelpLibrary;
 begin
 begin
   if HHCtrl = 0 then begin
   if HHCtrl = 0 then begin
-    HHCtrl := LoadLibrary('hhctrl.ocx');
+    HHCtrl := LoadLibrary(PChar(AddBackslash(GetSystemDir) + 'hhctrl.ocx'));
     if HHCtrl <> 0 then
     if HHCtrl <> 0 then
       HtmlHelp := GetProcAddress(HHCtrl, {$IFDEF UNICODE}'HtmlHelpW'{$ELSE}'HtmlHelpA'{$ENDIF})
       HtmlHelp := GetProcAddress(HHCtrl, {$IFDEF UNICODE}'HtmlHelpW'{$ELSE}'HtmlHelpA'{$ENDIF})
     else
     else

+ 1 - 1
Projects/InstFnc2.pas

@@ -613,7 +613,7 @@ end;
 
 
 initialization
 initialization
   InitOle;
   InitOle;
-  SHCreateItemFromParsingNameFunc := GetProcAddress(SafeLoadLibrary(shell32,
+  SHCreateItemFromParsingNameFunc := GetProcAddress(SafeLoadLibrary(AddBackslash(GetSystemDir) + shell32,
     SEM_NOOPENFILEERRORBOX), 'SHCreateItemFromParsingName');
     SEM_NOOPENFILEERRORBOX), 'SHCreateItemFromParsingName');
 
 
 finalization
 finalization

+ 2 - 2
Projects/Main.pas

@@ -1480,7 +1480,7 @@ begin
     Filename := shfolder;
     Filename := shfolder;
   { Ensure shell32.dll is pre-loaded so it isn't loaded/freed for each
   { Ensure shell32.dll is pre-loaded so it isn't loaded/freed for each
     individual SHGetFolderPath call }
     individual SHGetFolderPath call }
-  SafeLoadLibrary(shell32, SEM_NOOPENFILEERRORBOX);
+  SafeLoadLibrary(AddBackslash(GetSystemDir) + shell32, SEM_NOOPENFILEERRORBOX);
   SHFolderDLLHandle := SafeLoadLibrary(Filename, SEM_NOOPENFILEERRORBOX);
   SHFolderDLLHandle := SafeLoadLibrary(Filename, SEM_NOOPENFILEERRORBOX);
   if SHFolderDLLHandle = 0 then
   if SHFolderDLLHandle = 0 then
     InternalError(Format('Failed to load DLL "%s"', [Filename]));
     InternalError(Format('Failed to load DLL "%s"', [Filename]));
@@ -4370,7 +4370,7 @@ initialization
   DeleteFilesAfterInstallList := TStringList.Create;
   DeleteFilesAfterInstallList := TStringList.Create;
   DeleteDirsAfterInstallList := TStringList.Create;
   DeleteDirsAfterInstallList := TStringList.Create;
   CloseApplicationsFilterList := TStringList.Create;
   CloseApplicationsFilterList := TStringList.Create;
-  SHGetKnownFolderPathFunc := GetProcAddress(SafeLoadLibrary(shell32,
+  SHGetKnownFolderPathFunc := GetProcAddress(SafeLoadLibrary(AddBackslash(GetSystemDir) + shell32,
     SEM_NOOPENFILEERRORBOX), 'SHGetKnownFolderPath');
     SEM_NOOPENFILEERRORBOX), 'SHGetKnownFolderPath');
 
 
 finalization
 finalization

+ 1 - 1
Projects/RedirFunc.pas

@@ -583,7 +583,7 @@ initialization
     and GetFileVersionInfoSize will try to load it when reading version info
     and GetFileVersionInfoSize will try to load it when reading version info
     on 16-bit files. We can't allow the DLL be loaded for the first time while
     on 16-bit files. We can't allow the DLL be loaded for the first time while
     FS redirection is disabled. }
     FS redirection is disabled. }
-  SafeLoadLibrary('shell32.dll', SEM_NOOPENFILEERRORBOX);
+  SafeLoadLibrary(AddBackslash(GetSystemDir) + 'shell32.dll', SEM_NOOPENFILEERRORBOX);
 
 
   { FormatMessage might be called with FS redirection disabled, so ensure
   { FormatMessage might be called with FS redirection disabled, so ensure
     that all the DLLs FormatMessage searches in for messages (e.g. netmsg.dll,
     that all the DLLs FormatMessage searches in for messages (e.g. netmsg.dll,

+ 1 - 1
Projects/Wizard.pas

@@ -2774,6 +2774,6 @@ begin
 end;
 end;
 
 
 initialization
 initialization
-  SHPathPrepareForWriteFunc := GetProcAddress(SafeLoadLibrary(shell32,
+  SHPathPrepareForWriteFunc := GetProcAddress(SafeLoadLibrary(AddBackslash(GetSystemDir) + shell32,
     SEM_NOOPENFILEERRORBOX), {$IFDEF UNICODE}'SHPathPrepareForWriteW'{$ELSE}'SHPathPrepareForWriteA'{$ENDIF});
     SEM_NOOPENFILEERRORBOX), {$IFDEF UNICODE}'SHPathPrepareForWriteW'{$ELSE}'SHPathPrepareForWriteA'{$ENDIF});
 end.
 end.