Announcement

Collapse
No announcement yet.

Sxs.dll

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Sxs.dll

    Microsoft recently released the Sxs.dll and API aimed to manage .NET assembly installation/uninstallation. This is a COM+ DLL, not a .NET assembly. More information is available here.

    Is anybody out there who already used it from PB?

    Regards,


    Peter Redei

  • #2
    "The Side-by-Side Assembly API installs, removes, or queries side-by-side assemblies from the system's side-by-side assembly store. The side-by-side assembly is the winSxS store on Windows XP and the Component Servicing Infrastructure (CSI) component store on Windows Vista and Windows Server 2008."

    How cryptic can you be?

    Ok.. what does it do?
    hellobasic

    Comment


    • #3
      You are correct.
      What I need is an installer in PB that fixes CrystalReports installation problems. Crystal installs on the server the .NET assemblies, but not to the GAC where .NET needs them. So I want to copy them programmatically if they are missing. There is a free utility called GACView that does that but only manually. GACView is not written in .NET, so PB can do it too. However, Jose's Type Lib viewer does not even show the DLL (it is in the \Windows\system32 directory).

      Peter Redei

      Comment


      • #4
        However, Jose's Type Lib viewer does not even show the DLL (it is in the \Windows\system32 directory).
        It is a low-level component that has not a type library. The following wrapper functions should allow you to use it. Good luck.

        Code:
        DECLARE FUNCTION CreateAssemblyCache LIB "sxs.dll" ALIAS "CreateAssemblyCache" ( _
           BYREF ppAsmCache AS DWORD _                     ' IAssemblyCache** ppAsmCache
         , BYVAL dwReserved AS DWORD _                     ' DWORD dwReserved
         ) AS LONG                                         ' HRESULT
        
        DECLARE FUNCTION CreateAssemblyNameObject LIB "sxs.dll" ALIAS "CreateAssemblyNameObject" ( _
           BYREF ppAssemblyNameObj AS DWORD _              ' LPASSEMBLYNAME** ppAssemblyNameObj
         , BYVAL szAssemblyName AS DWORD _                 ' LPCWSTR szAssemblyName
         , BYVAL dwFlags AS DWORD _                        ' DWORD dwFlags
         , BYVAL pvReserved AS DWORD _                     ' LPVOID pvReserved
         ) AS LONG                                         ' HRESULT
        
        ' ASM_CMP_FLAGS Enumeration
        %ASM_CMPF_NAME             = &H1
        %ASM_CMPF_MAJOR_VERSION    = &H2
        %ASM_CMPF_MINOR_VERSION    = &H4
        %ASM_CMPF_BUILD_NUMBER     = &H8
        %ASM_CMPF_REVISION_NUMBER  = &H10
        %ASM_CMPF_PUBLIC_KEY_TOKEN = &H20
        %ASM_CMPF_CULTURE          = &H40
        %ASM_CMPF_CUSTOM           = &H80
        %ASM_CMPF_ALL              = %ASM_CMPF_NAME OR _
                                     %ASM_CMPF_MAJOR_VERSION OR _
                                     %ASM_CMPF_MINOR_VERSION OR _
                                     %ASM_CMPF_REVISION_NUMBER OR _
                                     %ASM_CMPF_BUILD_NUMBER OR _
                                     %ASM_CMPF_PUBLIC_KEY_TOKEN OR _
                                     %ASM_CMPF_CULTURE OR _
                                     %ASM_CMPF_CUSTOM
        %ASM_CMPF_DEFAULT          = &H100
        
        ' ASM_DISPLAY_FLAGS Enumeration
        %ASM_DISPLAYF_VERSION               = &H1
        %ASM_DISPLAYF_CULTURE               = &H2
        %ASM_DISPLAYF_PUBLIC_KEY_TOKEN      = &H4
        %ASM_DISPLAYF_PUBLIC_KEY            = &H8
        %ASM_DISPLAYF_CUSTOM                = &H10
        %ASM_DISPLAYF_PROCESSORARCHITECTURE = &H20
        %ASM_DISPLAYF_LANGUAGEID            = &H40
        
        ' ASM_NAME Enumeration
        %ASM_NAME_PUBLIC_KEY            = 0
        %ASM_NAME_PUBLIC_KEY_TOKEN      = %ASM_NAME_PUBLIC_KEY            + 1
        %ASM_NAME_HASH_VALUE            = %ASM_NAME_PUBLIC_KEY_TOKEN      + 1
        %ASM_NAME_NAME                  = %ASM_NAME_HASH_VALUE            + 1
        %ASM_NAME_MAJOR_VERSION         = %ASM_NAME_NAME                  + 1
        %ASM_NAME_MINOR_VERSION         = %ASM_NAME_MAJOR_VERSION         + 1
        %ASM_NAME_BUILD_NUMBER          = %ASM_NAME_MINOR_VERSION         + 1
        %ASM_NAME_REVISION_NUMBER       = %ASM_NAME_BUILD_NUMBER          + 1
        %ASM_NAME_CULTURE               = %ASM_NAME_REVISION_NUMBER       + 1
        %ASM_NAME_PROCESSOR_ID_ARRAY    = %ASM_NAME_CULTURE               + 1
        %ASM_NAME_OSINFO_ARRAY          = %ASM_NAME_PROCESSOR_ID_ARRAY    + 1
        %ASM_NAME_HASH_ALGID            = %ASM_NAME_OSINFO_ARRAY          + 1
        %ASM_NAME_ALIAS                 = %ASM_NAME_HASH_ALGID            + 1
        %ASM_NAME_CODEBASE_URL          = %ASM_NAME_ALIAS                 + 1
        %ASM_NAME_CODEBASE_LASTMOD      = %ASM_NAME_CODEBASE_URL          + 1
        %ASM_NAME_NULL_PUBLIC_KEY       = %ASM_NAME_CODEBASE_LASTMOD      + 1
        %ASM_NAME_NULL_PUBLIC_KEY_TOKEN = %ASM_NAME_NULL_PUBLIC_KEY       + 1
        %ASM_NAME_CUSTOM                = %ASM_NAME_NULL_PUBLIC_KEY_TOKEN + 1
        %ASM_NAME_NULL_CUSTOM           = %ASM_NAME_CUSTOM                + 1
        %ASM_NAME_MVID                  = %ASM_NAME_NULL_CUSTOM           + 1
        %ASM_NAME_MAX_PARAMS            = %ASM_NAME_MVID                  + 1
        
        ' CREATE_ASM_NAME_OBJ_FLAGS Enumeration
        %CANOF_PARSE_DISPLAY_NAME = &H1
        %CANOF_SET_DEFAULT_VALUES = &H2
        
        TYPE FUSION_INSTALL_REFERENCE
           cbSize AS DWORD
           dwFlags AS DWORD
           guidScheme AS GUID
           szIdentifier AS WORD PTR
           szNonCannonicalData AS WORD PTR
        END TYPE
        
        TYPE ASSEMBLY_INFO
           cbAssemblyInfo AS DWORD
           dwAssemblyFlags AS DWORD
           uliAssemblySizeInKB AS QUAD
           pszCurrentAssemblyPathBuf AS WORD PTR
           cchBuf AS DWORD
        END TYPE
        
        FUNCTION IUnknown_QueryInterface (BYVAL pthis AS DWORD PTR, BYREF riid AS GUID, BYREF ppvObj AS DWORD) AS LONG
           LOCAL HRESULT AS LONG
           IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
           CALL DWORD @@pthis[0] USING IUnknown_QueryInterface(pthis, riid, ppvObj) TO HRESULT
           FUNCTION = HRESULT
        END FUNCTION
        
        FUNCTION IUnknown_AddRef (BYVAL pthis AS DWORD PTR) AS DWORD
           LOCAL DWRESULT AS LONG
           IF pthis = %NULL THEN EXIT FUNCTION
           CALL DWORD @@pthis[1] USING IUnknown_AddRef(pthis) TO DWRESULT
           FUNCTION = DWRESULT
        END FUNCTION
        
        FUNCTION IUnknown_Release (BYVAL pthis AS DWORD PTR) AS DWORD
           LOCAL DWRESULT AS DWORD
           IF pthis = %NULL THEN EXIT FUNCTION
           CALL DWORD @@pthis[2] USING IUnknown_Release(pthis) TO DWRESULT
           FUNCTION = DWRESULT
        END FUNCTION
        
        FUNCTION IAssemblyCache_UninstallAssembly ( _
           BYVAL pthis AS DWORD PTR _                      ' [in]             IUnknown *pthis
         , BYVAL dwFlags AS DWORD _                        ' [in]             DWORD dwFlags
         , BYVAL pszAssemblyName AS DWORD _                ' [in]             LPCWSTR pszAssemblyName
         , BYREF pRefData AS FUSION_INSTALL_REFERENCE _    ' [in]             LPCFUSION_INSTALL_REFERENCE pRefData
         , BYREF pulDisposition AS DWORD _                 ' [out, optional]  ULONG* pulDisposition
         ) AS LONG                                         ' HRESULT
        
           LOCAL HRESULT AS LONG
           IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
           CALL DWORD @@pthis[3] USING IAssemblyCache_UninstallAssembly(pthis, dwFlags, pszAssemblyName, pRefData, pulDisposition) TO HRESULT
           FUNCTION = HRESULT
        
        END FUNCTION
        
        FUNCTION IAssemblyCache_QueryAssemblyInfo ( _
           BYVAL pthis AS DWORD PTR _                      ' [in]            IUnknown *pthis
         , BYVAL dwFlags AS DWORD _                        ' [in, optional]  DWORD dwFlags
         , BYVAL pszAssemblyName AS DWORD _                ' [in]            LPCWSTR pszAssemblyName
         , BYREF pAsmInfo AS ASSEMBLY_INFO _               ' [in, out]       ASSEMBLY_INFO* pAsmInfo
         ) AS LONG                                         ' HRESULT
        
           LOCAL HRESULT AS LONG
           IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
           CALL DWORD @@pthis[4] USING IAssemblyCache_QueryAssemblyInfo(pthis, dwFlags, pszAssemblyName, pAsmInfo) TO HRESULT
           FUNCTION = HRESULT
        
        END FUNCTION
        
        FUNCTION IAssemblyCache_CreateAssemblyCacheItem ( _
           BYVAL pthis AS DWORD PTR _                      ' [in]            IUnknown *pthis
         , BYVAL dwFlags AS DWORD _                        ' [in]            DWORD dwFlags,
         , BYVAL pvReserved AS DWORD _                     ' [in]            PVOID pvReserved
         , BYREF ppAsmItem AS DWORD _                      ' [out]           IAssemblyCacheItem** ppAsmItem,
         , BYVAL pszAssemblyName AS DWORD _                ' [in, optional]  LPCWSTR pszAssemblyName
         ) AS LONG                                         ' HRESULT
        
           LOCAL HRESULT AS LONG
           IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
           CALL DWORD @@pthis[5] USING IAssemblyCache_CreateAssemblyCacheItem(pthis, dwFlags, pvReserved, ppAsmItem, pszAssemblyName) TO HRESULT
           FUNCTION = HRESULT
        
        END FUNCTION
        
        FUNCTION IAssemblyCache_InstallAssembly ( _
           BYVAL pthis AS DWORD PTR _                      ' [in]            IUnknown *pthis
         , BYVAL dwFlags AS DWORD _                        ' [in]            DWORD dwFlags
         , BYVAL pszManifestFilePath AS DWORD _            ' [in]            LPCWSTR pszManifestFilePath
         , BYREF pRefData AS FUSION_INSTALL_REFERENCE _    ' [in, optional]  LPCFUSION_INSTALL_REFERENCE pRefData
         ) AS LONG                                         ' HRESULT
        
           LOCAL HRESULT AS LONG
           IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
           CALL DWORD @@pthis[6] USING IAssemblyCache_InstallAssembly(pthis, dwFlags, pszManifestFilePath,  pRefData) TO HRESULT
           FUNCTION = HRESULT
        
        END FUNCTION
        
        FUNCTION IAssemblyCacheItem_Commit ( _
           BYVAL pthis AS DWORD PTR _                      ' [in]             IUnknown *pthis
         , BYVAL dwFlags AS DWORD _                        ' [in]             DWORD dwFlags
         , BYREF pulDisposition AS DWORD _                 ' [out, optional]  ULONG* pulDisposition
         ) AS LONG                                         ' HRESULT
        
           LOCAL HRESULT AS LONG
           IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
           CALL DWORD @@pthis[3] USING IAssemblyCacheItem_Commit(pthis, dwFlags, pulDisposition) TO HRESULT
           FUNCTION = HRESULT
        
        END FUNCTION
        
        FUNCTION IAssemblyCacheItem_CreateStream ( _
           BYVAL pthis AS DWORD PTR _                      ' [in]        IUnknown *pthis
         , BYVAL dwFlags AS DWORD _                        ' [in]        DWORD dwFlags
         , BYVAL pszStreamName AS DWORD _                  ' [in]        LPCWSTR pszStreamName
         , BYVAL dwFormat AS DWORD _                       ' [in]        DWORD dwFormat
         , BYVAL dwFormatFlags AS DWORD _                  ' [in]        DWORD dwFormatFlags
         , BYREF ppIStream AS DWORD _                      ' [out]       IStream** ppIStream
         , BYVAL puliMaxSize AS QUAD _                     ' [optional]  ULARGE_INTEGER* puliMaxSize
         ) AS LONG                                         ' HRESULT
        
           LOCAL HRESULT AS LONG
           IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
           CALL DWORD @@pthis[4] USING IAssemblyCacheItem_CreateStream(pthis, dwFlags, pszStreamName, dwFormat, dwFormatFlags, ppIStream, puliMaxSize) TO HRESULT
           FUNCTION = HRESULT
        
        END FUNCTION
        
        FUNCTION IAssemblyName_Clone ( _
           BYVAL pthis AS DWORD PTR _                      ' [in]   IUnknown *pthis
         , BYREF pName AS DWORD _                          ' [out]  IAssemblyName** pName
         ) AS LONG                                         ' HRESULT
        
           LOCAL HRESULT AS LONG
           IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
           CALL DWORD @@pthis[3] USING IAssemblyName_Clone(pthis, pName) TO HRESULT
           FUNCTION = HRESULT
        
        END FUNCTION
        
        FUNCTION IAssemblyName_Finalize ( _
           BYVAL pthis AS DWORD PTR _                      ' [in]   IUnknown *pthis
         ) AS LONG                                         ' HRESULT
        
           LOCAL HRESULT AS LONG
           IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
           CALL DWORD @@pthis[4] USING IAssemblyName_Finalize(pthis) TO HRESULT
           FUNCTION = HRESULT
        
        END FUNCTION
        
        FUNCTION IAssemblyName_GetDisplayName ( _
           BYVAL pthis AS DWORD PTR _                      ' [in]       IUnknown *pthis
         , BYREF szDisplayName AS DWORD _                  ' [out]      LPOLESTR szDisplayName
         , BYREF pccDisplayName AS DWORD _                 ' [in, out]  LPDWORD pccDisplayName
         , BYVAL dwDisplayFlags AS DWORD _                 ' [in]       DWORD dwDisplayFlags
         ) AS LONG                                         ' HRESULT
        
           LOCAL HRESULT AS LONG
           IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
           CALL DWORD @@pthis[5] USING IAssemblyName_GetDisplayName(pthis, szDisplayName, pccDisplayName, dwDisplayFlags) TO HRESULT
           FUNCTION = HRESULT
        
        END FUNCTION
        
        FUNCTION IAssemblyName_GetName ( _
           BYVAL pthis AS DWORD PTR _                      ' [in]       IUnknown *pthis
         , BYREF lpcwBuffer AS DWORD _                     ' [in, out]  LPDWORD lpcwBuffer
         , BYREF pwzName AS DWORD _                        ' [out]      WCHAR* pwzName
         ) AS LONG                                         ' HRESULT
        
           LOCAL HRESULT AS LONG
           IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
           CALL DWORD @@pthis[6] USING IAssemblyName_GetName(pthis, lpcwBuffer, pwzName) TO HRESULT
           FUNCTION = HRESULT
        
        END FUNCTION
        
        FUNCTION IAssemblyName_GetProperty ( _
           BYVAL pthis AS DWORD PTR _                      ' [in]       IUnknown *pthis
         , BYVAL PropertyId AS DWORD _                     ' [in]       DWORD PropertyId
         , BYREF pvProperty AS DWORD _                     ' [out]      LPVOID pvProperty
         , BYREF pcbProperty AS DWORD _                    ' [in, out]  LPDWORD pcbProperty
         ) AS LONG                                         ' HRESULT
        
           LOCAL HRESULT AS LONG
           IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
           CALL DWORD @@pthis[7] USING IAssemblyName_GetProperty(pthis, PropertyId, pvProperty, pcbProperty) TO HRESULT
           FUNCTION = HRESULT
        
        END FUNCTION
        
        FUNCTION IAssemblyName_IsEqual ( _
           BYVAL pthis AS DWORD PTR _                      ' [in]  IUnknown *pthis
         , BYVAL pName AS DWORD _                          ' [in]  IAssemblyName* pName
         , BYVAL dwCmpFlags AS DWORD _                     ' [in]  DWORD dwCmpFlags
         ) AS LONG                                         ' HRESULT
        
           LOCAL HRESULT AS LONG
           IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
           CALL DWORD @@pthis[8] USING IAssemblyName_IsEqual(pthis, pName, dwCmpFlags) TO HRESULT
           FUNCTION = HRESULT
        
        END FUNCTION
        
        FUNCTION IAssemblyName_SetProperty ( _
           BYVAL pthis AS DWORD PTR _                      ' [in]            IUnknown *pthis
         , BYVAL PropertyId AS DWORD _                     ' [in]            DWORD PropertyId
         , BYVAL pvProperty AS DWORD _                     ' [in]            LPVOID pvProperty
         , BYVAL cbProperty AS DWORD _                     ' [in, optional]  DWORD cbProperty
         ) AS LONG                                         ' HRESULT
        
           LOCAL HRESULT AS LONG
           IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
           CALL DWORD @@pthis[9] USING IAssemblyName_SetProperty(pthis, PropertyId, pvProperty,cbProperty) TO HRESULT
           FUNCTION = HRESULT
        
        END FUNCTION
        Forum: http://www.jose.it-berater.org/smfforum/index.php

        Comment


        • #5
          Thank you Jose, what a service! You are great! Now, I just have to figure out how to use it.




          Peter Redei

          Comment

          Working...
          X