使用Flash ActiveX免注册 [英] Use Flash ActiveX as registration free

查看:188
本文介绍了使用Flash ActiveX免注册的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用flash activex组件的游戏。

I have a game that uses flash activex component.

问题是我需要一个特定版本的flash。

The problem is I need a specific version of flash.

我不想在现有的更高版本上注册组件,这可能导致大的安全问题。我只想使用它为我的应用程序。

I don't want to register the component over the existing higher version which can cause big security issues. I only want to use it for my application.

我听说过注册免费com技术使用清单文件为我的应用程序,但没有找到任何使用它与闪光activex或甚至它的可能。

I've heard about registration free com technology using a manifest file for my application but didn't found any information on using it with flash activex or even its possible.

所以我的问题是有可能我们的flash activex组件作为注册免费com?如果是,那么要求和清单文件应该如何显示为我的尝试失败。

So my question is it possible to us the flash activex component as a registration free com? if yes then what are the requirements and how the manifest file should look as my try failed.

这是我试过的.manifest:

This is the .manifest I've tried:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <assemblyIdentity type="win32" name="App" version="1.0.0.1" 
        processorArchitecture="x86" publicKeyToken="0000000000000000" />

  <file name="Flash8.ocx">
    <comClass clsid="{D27CDB6E-AE6D-11cf-96B8-444553540000}" threadingModel="Both" />
  </file>
</assembly>


推荐答案

警告:在我给你太多的希望之前没有用Flash测试这个。我已经测试它与较小的东西,我拥有COM客户端和服务器。如果Flash或某些软件依赖于除纯COM和ActiveX控件之外的注册表设置,即使这样,清单中不可用的设置(例如类别),也可能无法工作。

WARNING: Before I give you too much hope, I haven't tested this with Flash. I've tested it with smaller stuff where I "owned" both COM client and server. If Flash or some software it depends on requires registry settings other than pure COM and ActiveX controls, and even so, settings which are not available in manifests (e.g. categories), this might not work.

定义一个组合清单< a>为Flash安装的每个文件,与闪存在安装期间注册的COM设置相匹配。如果您知道足够的COM,您'll - 知道 - 其中 - - 查看 a>。每个这些清单文件必须有不同于DLL的名称。

Define one Assembly Manifest for each file that Flash installs, that matches the COM settings that Flash registers during installation. If you know enough COM, you'll-know-where-to-look. Each of these manifest files must have a name different from the DLL.

然后,创建应用程序清单,并在您先前选择的文件名后添加程序集依赖项。如果您的应用程式没有内嵌的清单,这将是< your-application> .exe.manifest 。如果有,您必须让您的构建工具包含这些依赖项。

Then, create an Application Manifest for your executable and add assembly dependencies after the file names you chose previously. If your application doesn't have an embedded manifest, this will be <your-application>.exe.manifest. If it has, you must make your build tool include these dependencies.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">

  <!--
    name: a string with the format: Organization.Division.Name
          Note: It doesn't matter
    version: 4 numbers between 0 and 65535 separated with dots
             Note: It doesn't matter
  -->
  <assemblyIdentity type="win32" name="My.Application" version="1.0.0.0"/>

  <dependency>
    <dependentAssembly>

      <!--
        name: a string with the format: Organization.Division.Name
              Note: It doesn't matter, but it must match what's in the manifest
        version: 4 numbers between 0 and 65535 separated with dots
                 Note: It doesn't matter, but it must match what's in the manifest
      -->
      <assemblyIdentity type="win32" name="Adobe.Flash.Control" version="8.0.42.0"/>

    </dependentAssembly>
  </dependency>
</assembly>






Adob​​e.Flash.Control.manifest




Adobe.Flash.Control.manifest

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">

  <!--
    name: a string with the format: Organization.Division.Name
          Note: It doesn't matter, but it must match what's in the dependency
    version: 4 numbers between 0 and 65535 separated with dots
             Note: It doesn't matter, but it must match what's in the dependency
  -->
  <assemblyIdentity type="win32" name="Adobe.Flash.Control" version="8.0.42.0"/>

  <!-- file elements
    name: HKEY_CLASSES_ROOT\CLSID\{CLSID}\InprocServer32, default value
          HKEY_CLASSES_ROOT\TypeLib\{TLBID}\{version}\{lcid}\win32, default value
          Note: Keep only the file names
          Note: In this case, the class factories and the type library happen to be in the same file
                Otherwise, the comClass and the typelib elements would be under different file elements
  -->

  <file name="Flash8g.ocx">

    <!-- comClass elements
      description:         HKEY_CLASSES_ROOT\CLSID\{CLSID}, default value
      clsid:               {CLSID}
      threadingModel:      HKEY_CLASSES_ROOT\CLSID\{CLSID}\InprocServer32, ThreadingModel
      tlbid:               HKEY_CLASSES_ROOT\CLSID\{CLSID}\TypeLib, default value
      progid:              HKEY_CLASSES_ROOT\CLSID\{CLSID}\ProgID, default value
      miscStatus:          HKEY_CLASSES_ROOT\CLSID\{CLSID}\MiscStatus, default value
      miscStatusIcon:      HKEY_CLASSES_ROOT\CLSID\{CLSID}\MiscStatus\4, default value
      miscStatusContent:   HKEY_CLASSES_ROOT\CLSID\{CLSID}\MiscStatus\1, default value
      miscStatusDocprint:  HKEY_CLASSES_ROOT\CLSID\{CLSID}\MiscStatus\8, default value
      miscStatusThumbnail: HKEY_CLASSES_ROOT\CLSID\{CLSID}\MiscStatus\2, default value
    -->

    <comClass description="Shockwave Flash Object"
              clsid="{D27CDB6E-AE6D-11cf-96B8-444553540000}"
              threadingModel="Apartment"
              tlbid="{D27CDB6B-AE6D-11cf-96B8-444553540000}"
              progid="ShockwaveFlash.ShockwaveFlash"
              miscStatus=""
              miscStatusContent="recomposeonresize,cantlinkinside,insideout,activatewhenvisible,setclientsitefirst">
      <progid>MacromediaFlashPaper.MacromediaFlashPaper</progid>
      <progid>ShockwaveFlash.ShockwaveFlash.1</progid>
      <progid>ShockwaveFlash.ShockwaveFlash.3</progid>
      <progid>ShockwaveFlash.ShockwaveFlash.4</progid>
      <progid>ShockwaveFlash.ShockwaveFlash.5</progid>
      <progid>ShockwaveFlash.ShockwaveFlash.6</progid>
      <progid>ShockwaveFlash.ShockwaveFlash.7</progid>
      <progid>ShockwaveFlash.ShockwaveFlash.8</progid>
    </comClass>

    <comClass description="Macromedia Flash Factory Object"
              clsid="{D27CDB70-AE6D-11cf-96B8-444553540000}"
              threadingModel="Apartment"
              tlbid="{D27CDB6B-AE6D-11cf-96B8-444553540000}"
              progid="FlashFactory.FlashFactory">
      <progid>FlashFactory.FlashFactory.1</progid>
    </comClass>

    <!-- typelib elements
      tlbid:      {TLBID}
      version:    HKEY_CLASSES_ROOT\CLSID\{CLSID}\Version, default value
                  HKEY_CLASSES_ROOT\Interface\{IID}\TypeLib, Version
      helpdir:    HKEY_CLASSES_ROOT\TypeLib\{TLBID}\{version}\HELPDIR, default value
      resourceid: HKEY_CLASSES_ROOT\TypeLib\{TLBID}\{lcid}, the subkey name
      flags:      HKEY_CLASSES_ROOT\TypeLib\{TLBID}\{version}\Flags, default value
    -->

    <typelib tlbid="{D27CDB6B-AE6D-11cf-96B8-444553540000}"
             version="1.0"
             helpdir="."
             resourceid="0"
             flags=""/>

    <!-- comInterfaceProxyStub elements
      iid:              {IID}
      name:             HKEY_CLASSES_ROOT\Interface\{IID}, default value
      tlbid:            HKEY_CLASSES_ROOT\Interface\{IID}\TypeLib, default value
      baseInterface:    HKEY_CLASSES_ROOT\Interface\{IID}\BaseInterface, default value
      numMethods:       HKEY_CLASSES_ROOT\Interface\{IID}\NumMethods, default value
      proxyStubClsid32: HKEY_CLASSES_ROOT\Interface\{IID}\ProxyStubClsid32, default value
      threadingModel:   HKEY_CLASSES_ROOT\CLSID\{ProxyStubClsid32}\InprocServer32, ThreadingModel
    -->
    <!-- I found no need for any comInterfaceProxyStub -->
  </file>

  <!-- comInterfaceExternalProxyStub elements
    iid:              {IID}
    baseInterface:    HKEY_CLASSES_ROOT\Interface\{IID}\BaseInterface, default value
    numMethods:       HKEY_CLASSES_ROOT\Interface\{IID}\NumMethods, default value
    name:             HKEY_CLASSES_ROOT\Interface\{IID}, default value
    tlbid:            HKEY_CLASSES_ROOT\Interface\{IID}\TypeLib, default value
    proxyStubClsid32: HKEY_CLASSES_ROOT\Interface\{IID}\ProxyStubClsid32, default value
  -->

  <!--
    I found these lingering from the current Flash installation I have.
    Please check if they are the same for Flash 8.
    If you don't need them, just remove them.

    These are comInterfaceExternalProxyStub and not comInterfaceProxyStub,
    because both {00020420-0000-0000-C000-000000000046} (PSDispatch, IDispatch-based interfaces)
    and {00020424-0000-0000-C000-000000000046} (PSOAInterface, Type Library interfaces)
    come with Windows.
  -->

  <comInterfaceExternalProxyStub iid="{86230738-D762-4C50-A2DE-A753E5B1686F}"
                                 name="IFlashObject"
                                 tlbid="{D27CDB6B-AE6D-11CF-96B8-444553540000}"
                                 proxyStubClsid32="{00020424-0000-0000-C000-000000000046}"/>

  <comInterfaceExternalProxyStub iid="{D27CDB6C-AE6D-11CF-96B8-444553540000}"
                                 name="IShockwaveFlash"
                                 tlbid="{D27CDB6B-AE6D-11CF-96B8-444553540000}"
                                 proxyStubClsid32="{00020424-0000-0000-C000-000000000046}"/>

  <comInterfaceExternalProxyStub iid="{D27CDB6D-AE6D-11CF-96B8-444553540000}"
                                 name="_IShockwaveFlashEvents"
                                 tlbid="{D27CDB6B-AE6D-11CF-96B8-444553540000}"
                                 proxyStubClsid32="{00020420-0000-0000-C000-000000000046}"/>

</assembly>






和它似乎工作。使用Process Explorer,我可以看到它加载本地Flash8g.ocx:


I tested with the following bare-bones example, and it seems to work. Using Process Explorer, I can see that it loads the local Flash8g.ocx:

#include <windows.h>

int WINAPI WinMain(
    HINSTANCE hInstance,
    HINSTANCE hPrevInstance,
    LPSTR lpCmdLine,
    int nCmdShow
)
{
    HRESULT hr;

    if (SUCCEEDED(hr = CoInitialize(NULL))) {
        CLSID clsid;
        // Both ways work
        if (SUCCEEDED(hr = CLSIDFromProgID(L"ShockwaveFlash.ShockwaveFlash.8", &clsid))) {
        /*if (SUCCEEDED(hr = CLSIDFromString(L"{D27CDB6E-AE6D-11cf-96B8-444553540000}", &clsid))) {*/
            IDispatch *flash;
            // IID_PPV_ARGS is better, but doesn't exist in older SDKs
            /*if (SUCCEEDED(hr = CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&flash)))) {*/
            if (SUCCEEDED(hr = CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER, IID_IDispatch, (void**)&flash))) {
                OLECHAR name[] = L"ReadyState";
                LPOLESTR names[] = { &name[0] };
                DISPID dispid;
                if (SUCCEEDED(hr = flash->GetIDsOfNames(IID_NULL, names, sizeof(names)/sizeof(names[0]), LOCALE_SYSTEM_DEFAULT, &dispid))) {
                    DISPPARAMS params;
                    VARIANT result;
                    EXCEPINFO excepinfo;
                    UINT argerr;
                    params.rgvarg = NULL;
                    params.rgdispidNamedArgs = NULL;
                    params.cArgs = 0;
                    params.cNamedArgs = 0;
                    // Initialize out args due to buggy IDispatch implementations
                    VariantInit(&result);
                    excepinfo.wCode = 0;
                    excepinfo.wReserved = 0;
                    excepinfo.bstrSource = NULL;
                    excepinfo.bstrDescription = NULL;
                    excepinfo.bstrHelpFile = NULL;
                    excepinfo.dwHelpContext = 0;
                    excepinfo.pvReserved = NULL;
                    excepinfo.pfnDeferredFillIn = NULL;
                    excepinfo.scode = S_OK;
                    argerr = 0;
                    if (SUCCEEDED(hr = flash->Invoke(dispid, IID_NULL, LOCALE_SYSTEM_DEFAULT, DISPATCH_PROPERTYGET, &params, &result, &excepinfo, &argerr))) {
                        MessageBox(NULL, "The example ran to completion.", "Flash test", MB_OK);
                        VariantClear(&result);
                        SysFreeString(excepinfo.bstrSource);
                        excepinfo.bstrSource = NULL;
                        SysFreeString(excepinfo.bstrDescription);
                        excepinfo.bstrDescription = NULL;
                        SysFreeString(excepinfo.bstrHelpFile);
                        excepinfo.bstrHelpFile = NULL;
                    }
                }
                flash->Release();
                flash = NULL;
            }
        }
        CoUninitialize();
    }
    if (SUCCEEDED(hr)) {
        return 0;
    }
    else {
        return 1;
    }
}

这篇关于使用Flash ActiveX免注册的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆