AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Win32/Win64 API (native code) DLL Side-by-side registration & redirection
Thema durchsuchen
Ansicht
Themen-Optionen

DLL Side-by-side registration & redirection

Ein Thema von Der schöne Günther · begonnen am 21. Jun 2018 · letzter Beitrag vom 22. Jun 2018
Antwort Antwort
Seite 2 von 2     12   
Der schöne Günther

Registriert seit: 6. Mär 2013
6.110 Beiträge
 
Delphi 10 Seattle Enterprise
 
#11

AW: DLL Side-by-side registration & redirection

  Alt 22. Jun 2018, 07:40
Also du bist der Boss deiner Anwendung und legst selber fest wo sich deine DLL's befinden sollen.
Wie schon eingangs geschrieben geht es nicht um eine simple DLL sondern eine ActiveX-Komponente die meines Wissens nach entweder fest im System registriert werden muss oder halt direkt über diese lustige Side-by-side registration eingebunden werden kann.
  Mit Zitat antworten Zitat
EWeiss
(Gast)

n/a Beiträge
 
#12

AW: DLL Side-by-side registration & redirection

  Alt 22. Jun 2018, 14:50
Zitat:
geht es nicht um eine simple DLL sondern eine ActiveX-Komponente
Ach so und du denkst die wären was besonderes? Was ist da soviel anders?
Wie viele ActiveX DLL's möchtest du haben die ich schon selbst geschrieben habe?

Aber da du diese nicht mit LoadLibrary in den Speicher laden willst vergiss es
denn das ist eine der Voraussetzungen um ActiveX dll's während der Laufzeit zu registrieren und auszuführen.
Wie gesagt im welchen Pfad diese sich befinden ist wurscht.

gruss

Geändert von EWeiss (22. Jun 2018 um 15:12 Uhr)
  Mit Zitat antworten Zitat
Der schöne Günther

Registriert seit: 6. Mär 2013
6.110 Beiträge
 
Delphi 10 Seattle Enterprise
 
#13

AW: DLL Side-by-side registration & redirection

  Alt 22. Jun 2018, 15:02
Ich halte mich an das was der Hersteller sagt.

Beispiel:
Zitat:
Prior to Windows XP, an ActiveX control had to be registered on the system before it could be used by an application. This registration creates a few issues among which:
Registering a control requires administrative rights on a system.
Registering a control affects multiple applications as the same DLL is shared among all applications using the same version of the control (some developers refer to this issue as the DLL hell.)
An application that unregisters a control will prevent all other applications from using it.
The solution to these issues is to use side-by-side activation, or registration-free components; a concept that is very similar to what was introduced with .NET.
When side-by-side registration is used, two things happen:
scvncctrl.dll can be placed in each application's folder and is not shared with other applications.
The ActiveX control is not registered in the system wide registry but each application acts as if it had its own registered component.
https://support.s-code.com/Knowledge...m-registration

Heißt: Es muss entweder registriert werden oder man nutzt "side-by-side".
  Mit Zitat antworten Zitat
EWeiss
(Gast)

n/a Beiträge
 
#14

AW: DLL Side-by-side registration & redirection

  Alt 22. Jun 2018, 15:07
Kenne die DLL nicht.
Zitat:
Heißt: Es muss entweder registriert werden oder man nutzt "side-by-side".
Oder LoadLibrary.

Ich mache es so.. mit LoadLibrary von meinem Plugin System.

Code:
Private Sub CheckVisPlugin()

    VisPlugin = GetSetting(App.EXEName, "Option", "PluginVisual", vbNullString)
    If Right$(VisPlugin, 4) = ".dll" Then
        RegServe VisPlugin, True
        VisPlugin = GetFileName(VisPlugin)
        PluginName = Left$(VisPlugin, Len(VisPlugin) - 4)
        Set PluginVis = CreateObject(PluginName & ".clsMain")
        msgPlg.Visual = True
        PluginVis.ToolBarVisible = frmToolbar.Visible = True
        PluginVis.EQVisible = frmEqualizer.Visible = True
        PluginVis.SkinChange sOldSkinName

        If Me.WindowState = vbMinimized Then
            PluginVis.PlayerVisible = False
        Else
            PluginVis.PlayerVisible = Me.Visible
        End If

        If stndPlayList = 1 Then
            PluginVis.PlaylistVisible = True
            PluginVis.PlaylistPos frmPlayList.Left, frmPlayList.Top, frmPlayList.Width, frmPlayList.Height
        Else
            PluginVis.PlaylistVisible = False
        End If
        PluginVis.Execute FrmMain_Hwnd
    End If

End Sub
Code:
Public Function RegServe(ByVal Path As String, _
                         ByVal mode As Boolean) As Boolean

Dim insthLib As Long
Dim lpLibAdr As Long
Dim hThd    As Long
Dim lpExCode As Long
Dim procName As String
Dim Result  As Long
Dim okFlag  As Boolean
'### DLL in den Speicher laden

    insthLib = LoadLibrary(Path)
    '### Aktion wählen
    If insthLib Then
        If mode Then
            procName = "DllRegisterServer"
        Else
            procName = "DllUnregisterServer"
        End If
        '### Adresse der DLL im Speicher
        lpLibAdr = GetProcAddress(insthLib, procName)
        If lpLibAdr <> 0 Then
            '### Aktion starten
            hThd = CreateThread(ByVal 0, 0, ByVal lpLibAdr, ByVal 0&, 0&, 0&)
            If hThd Then
                '### Maximal 5 sec warten
                Result = WaitForSingleObject(hThd, 5000)
                If Result = STATUS_WAIT_0 Then
                    '### Vorgang erfolgreich in 5 sec beendet
                    Call CloseHandle(hThd)
                    okFlag = True
                Else
                    '### 5 sek. überschritten -> Thread schließen
                    Call GetExitCodeThread(hThd, lpExCode)
                    Call ExitThread(lpExCode)
                    Call CloseHandle(hThd)
                End If
            End If
        End If
        '### Speicher wieder freigeben
        Call FreeLibrary(insthLib)
    End If
   
    If Not okFlag Then
        MsgBox ("Fehler! Der Vorgang wurde abgebrochen.")
    Else
        'MsgBox ("Der Vorgang war erfolgreich!")
    End If
   
    RegServe = okFlag
   
End Function
Nur damit du siehst das ich dir nicht nur was erzähle sondern weis wie es geht.

gruss

Geändert von EWeiss (22. Jun 2018 um 15:14 Uhr)
  Mit Zitat antworten Zitat
Der schöne Günther

Registriert seit: 6. Mär 2013
6.110 Beiträge
 
Delphi 10 Seattle Enterprise
 
#15

AW: DLL Side-by-side registration & redirection

  Alt 22. Jun 2018, 15:27
Und das funktioniert ohne Adminrechte?

Denn regsvr32.exe macht ja im Endeffekt auch genau das was der obige Quellcode tut. Ich bin sehr ungläubig, aber ich probiere es bei Gelegenheit aus.


MSDN: ActiveX-DLLs und OCX-Dateien per Quellcode registrieren und deregistrieren
  Mit Zitat antworten Zitat
EWeiss
(Gast)

n/a Beiträge
 
#16

AW: DLL Side-by-side registration & redirection

  Alt 22. Jun 2018, 15:35
Und das funktioniert ohne Adminrechte?

Denn regsvr32.exe macht ja im Endeffekt auch genau das was der obige Quellcode tut. Ich bin sehr ungläubig, aber ich probiere es bei Gelegenheit aus.


MSDN: ActiveX-DLLs und OCX-Dateien per Quellcode registrieren und deregistrieren
Also mein Player benötigt keine Adminrechte von daher
Aber ich habe nebenbei aus Sicherheitsgründen das noch zu meinem Manifest addiert.
Du hättest es nicht extra nochmal verlinken müssen denn hier steht doch wie es geht.

Code:
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
    <security>
      <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
        <!-- UAC Manifest Options
             If you want to change the Windows User Account Control level replace the
             requestedExecutionLevel node with one of the following.

        <requestedExecutionLevel level="asInvoker" uiAccess="false" />
        <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
        <requestedExecutionLevel level="highestAvailable" uiAccess="false" />

            Specifying requestedExecutionLevel element will disable file and registry virtualization.
            Remove this element if your application requires this virtualization for backwards
            compatibility.
        -->
        <requestedExecutionLevel level="asInvoker" uiAccess="false" />
      </requestedPrivileges>
    </security>
  </trustInfo>
Wie gesagt ich kann alle meine DLL's zur Laufzeit registrieren und unregistrieren wo sich der Pfad zur DLL befindet ist dabei zu vernachlässigen.
Und im übrigen alle Dll's die mit VB erstellt werden sind ActiveX Dll's (denn hier gibt es keine "normalen" Dll's)

Ich verwende kein regServ32 sondern erstelle das Objekt selbst wenn LoadLibrary erfolgreich war.
Siehe!
CreateObject(PluginName & ".clsMain")

clsMain ist der Einsprungs punkt der geladenen DLL.
Diese Classe muss in jeder DLL vorhanden sein.

gruss

Geändert von EWeiss (23. Jun 2018 um 06:20 Uhr)
  Mit Zitat antworten Zitat
Antwort Antwort
Seite 2 von 2     12   


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 19:06 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz