locked
调用CeRapiInvoke时总是返回"无效签名" RRS feed

  • 问题

  • 调用CeRapiInvoke时总是返回"无效签名"
    源代码都ms支持中心的例子,可是它上面没有写用什么环境编译的.
    断点提示: hr 0x80090006 无效签名。 HRESULT

    手机端dll代码:(vs2008 VC++ win32智能设备dll)

    #include <windows.h>
    #include <rapi.h>
    extern "C"
    {
        __declspec(dllexport) int CallMyFunction(DWORD cbInput,
            BYTE* pInput, DWORD* pcbOutput, BYTE** ppOutput,
            IRAPIStream* pStream);
    }
    int CallMyFunction(DWORD cbInput, BYTE* pInput,
                       DWORD* pcbOutput, BYTE** ppOutput,
                       IRAPIStream* pStream)
    {
        MEMORYSTATUS structMemStatus;
        DWORD dwMemAvailPhys;
        char    szFree[10];
        //Initialize buffer to all NULLs
        ZeroMemory(szFree, 10);
        GlobalMemoryStatus(&structMemStatus);
        dwMemAvailPhys = structMemStatus.dwAvailPhys;
        sprintf(szFree, "%d", dwMemAvailPhys/1024);
        //Provide extra char for NULL
        *ppOutput = (BYTE*)LocalAlloc(LPTR, strlen(szFree)+1);
        if(*ppOutput)
        {
            //Copy along with NULL
            strncpy((char*)*ppOutput, szFree, strlen(szFree)+1);
            *pcbOutput = strlen(szFree) + 1;
        }
        else
            *pcbOutput = 0;
        return 0;
    }


    调用代码:(vs2008 VC++ win32智能设备控制台)

        DWORD    cbOut;
        BYTE*    pOut;
        HRESULT    hr;
        //Initialize Windows CE RAPI
        hr = CeRapiInit();
        //Invoke CallMyFunction routine in MyRapi DLL in the \Windows directory.
        hr = CeRapiInvoke(L"RapiServ", L"CallMyFunction",
            0, NULL, &cbOut, &pOut, NULL, 0);
        if(cbOut)
            printf("Your device got %s KB of Physical Memory available", pOut);
        else
            printf("No memory available in the device");
        //Uninitialize Windows CE RAPI
        hr = CeRapiUninit();
        //Free the DLL allocated memory.
        if(pOut)
            LocalFree(pOut);
    2010年1月15日 17:01

答案

  • 呵呵,又发到这里了

    1.       On the Project menu, click Properties.

    2.       Click Authenticode Signing.

    3.       For the Authenticode Signature property, click Yes.

    4.       For the Certificate property, click the Ellipses (...) button.

    In the Select Certificate dialog box, do one of the following:

    >> If the certificate you want appears in the list, select it, and then click OK.

    >> If the certificate you want does not appear in the list, click Manage Certificates to open the Manage Certificates dialog box. Use this dialog box to import one of the SDK certificates (or import the certificate an OEM or mobile operator gave you as part of its developer program).

     

    Note: 

    Be sure to use the *.pfx file, not the *.cer file. 

     

    On the Authenticode Signing page, click OK.


    Passion
    • 已标记为答案 小炳 2010年1月18日 4:12
    2010年1月16日 2:10

全部回复

  • 呵呵,又发到这里了

    1.       On the Project menu, click Properties.

    2.       Click Authenticode Signing.

    3.       For the Authenticode Signature property, click Yes.

    4.       For the Certificate property, click the Ellipses (...) button.

    In the Select Certificate dialog box, do one of the following:

    >> If the certificate you want appears in the list, select it, and then click OK.

    >> If the certificate you want does not appear in the list, click Manage Certificates to open the Manage Certificates dialog box. Use this dialog box to import one of the SDK certificates (or import the certificate an OEM or mobile operator gave you as part of its developer program).

     

    Note: 

    Be sure to use the *.pfx file, not the *.cer file. 

     

    On the Authenticode Signing page, click OK.


    Passion
    • 已标记为答案 小炳 2010年1月18日 4:12
    2010年1月16日 2:10
  • 谢谢~~~

    2010年1月18日 4:12