浏览代码

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

Martijn Laan 9 年之前
父节点
当前提交
96c253ef65

+ 1 - 1
Components/FolderTreeView.pas

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

+ 1 - 1
Components/NewCheckListBox.pas

@@ -357,7 +357,7 @@ var
   M: HMODULE;
 begin
   if not OleAccInited then begin
-    M := LoadLibrary('oleacc.dll');
+    M := LoadLibrary(AddBackslash(GetSystemDir) + 'oleacc.dll');
     if M <> 0 then begin
       LresultFromObjectFunc := GetProcAddress(M, 'LresultFromObject');
       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 }
   if (RestartManagerLibrary = 0) and (Lo(GetVersion) >= 6) then
   begin
-    RestartManagerLibrary := LoadLibrary(restartmanagerlib);
+    RestartManagerLibrary := LoadLibrary(PChar(AddBackslash(GetSystemDir) + restartmanagerlib));
     if RestartManagerLibrary <> 0 then
     begin
       RmStartSession := GetProcAddress(RestartManagerLibrary, 'RmStartSession');

+ 3 - 3
Components/RichEditViewer.pas

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

+ 1 - 1
Components/UxThemeISX.pas

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

+ 1 - 1
Projects/CmnFunc2.pas

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

+ 1 - 1
Projects/HtmlHelpFunc.pas

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

+ 1 - 1
Projects/InstFnc2.pas

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

+ 2 - 2
Projects/Main.pas

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

+ 1 - 1
Projects/RedirFunc.pas

@@ -583,7 +583,7 @@ initialization
     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
     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
     that all the DLLs FormatMessage searches in for messages (e.g. netmsg.dll,

+ 1 - 1
Projects/Wizard.pas

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