Rapi.Invoke

Last post 03-05-2008 10:50 by anguli. 12 replies.
Page 1 of 1 (13 items)
Sort Posts: Previous Next
  • 10-28-2007 6:34

    Rapi.Invoke

    Hi all,
    I built a C# application that invoke a remote procedure from a c dll usind rapi.Ivoke, the problem that there is an exception its details:
    System.ArgumentNullException was unhandled
    Message="Value cannot be null.\r\nParameter name: source"
    Source="mscorlib"
    ParamName="source"

    The dll code (calle):
    HRESULT CeGetDeviceID(DWORD cbInput, BYTE *pbInput, DWORD *pcbOutput, BYTE **ppbOutput,PVOID pviod)
    {
    *pcbOutput = 1;
    *ppbOutput = (BYTE*) LocalAlloc(LPTR, 1);
    return S_OK;
    }


    The C# code (caller):
    rapi.Connect();
    if (rapi.Connected)
    {
    try
    {
    rapi.Invoke(dllPath, funName, input,out output);
    }
    catch (RAPIException ex)
    {
    Console.WriteLine(ex.Message);
    Console.WriteLine(ex.StackTrace);

    }
    rapi.Disconnect();
    where rapi is an instance of RAPI created , input is a byte array created , output is a byte array

    Best regards,
  • 10-28-2007 6:41 In reply to

    • neil
    • OpenNETCF Staff
    • Top 10 Contributor
    • Joined on 07-30-2007
    • North Wales
    • Posts 1,110

    Re: Rapi.Invoke

    Everything you need to retrieve the device ID can be found here

    Neil Cowburn
    Principal Partner
    OpenNETCF Consulting, LLC

    This posting is provided "AS IS" with no warranties, and confers no rights.
  • 10-29-2007 0:07 In reply to

    Re: Rapi.Invoke

    Thanx for ur reply Neil,
    The problem not how to write a code that retrieve the device ID , i read that & it helped me so much but the problem is the exception i get after that
    so please I need help me in it
    Best Regards,
    Jana
  • 11-27-2007 8:36 In reply to

    Re: Rapi.Invoke

    Hi,

    Is there someone who has the RapiEx.dll for me?
    í'm trying the stuff on http://blog.opennetcf.com/ncowburn/2007/07/27/HOWTORetrieveTheDeviceIDFromTheDesktop.aspx, but if you guys allready created the rapiEx.dll, its useless that i do the same work again..

    --edit allready got it myself..--

    Thanks!

    Greets, Erik
  • 12-04-2007 6:04 In reply to

    Re: Rapi.Invoke

    I've got the same problem as you janaEMNRS. The call to the dll is effective. Nevertheless, I always trap the same Exception : "Value cannot be null. Parameter name: source".

    I've created the dll with EVC4++ and it seems to be correct. I have no idea.
  • 01-14-2008 9:09 In reply to

    • neil
    • OpenNETCF Staff
    • Top 10 Contributor
    • Joined on 07-30-2007
    • North Wales
    • Posts 1,110

    Re: Rapi.Invoke

    You need to make sure that the RAPI Security Policy for your device is set to Allowed and not Restricted.

    Neil Cowburn
    Principal Partner
    OpenNETCF Consulting, LLC

    This posting is provided "AS IS" with no warranties, and confers no rights.
  • 02-15-2008 10:50 In reply to

    • vhuang
    • Top 500 Contributor
    • Joined on 02-15-2008
    • Posts 1

     Neil,

           Could show me how i access RAPI Security Policy in device.

     
    Best Regards
     

  • 02-21-2008 18:33 In reply to

    • Ken
    • Top 500 Contributor
    • Joined on 02-22-2008
    • Posts 1

    Unable to adjust RAPI Security Policy

    I'm having the same problem described by others on this thread, an ArgumentNullException being thrown by Rapi.Invoke. I'm using a Symbol MC70 device running WM 5.1.70 and a version of OpenNetCf that I downloaded in May 2006. 

    Based on the information in this thread, I downloaded the Security Configuration Manager, but like many other people, it refused to connect to my device, hanging at "Querying device configuration". So I'm stuck not being able to make my Rapi call and ignorant as to how to view/adjust device settings to allow it.

     Any insight would be appreciated.

     Ken

    Filed under:
  • 02-22-2008 3:50 In reply to

    • neil
    • OpenNETCF Staff
    • Top 10 Contributor
    • Joined on 07-30-2007
    • North Wales
    • Posts 1,110

    Re: Unable to adjust RAPI Security Policy

    @Ken: Just a quick correction: there is no product called OpenNETCF. Using OpenNETCF in the way you did is like saying "I'm using Microsoft 1.0". We're not a one product company.

    Have you tried manually copying tool.cab from %Program Files%\Microsoft\Security Configuration Manager\tool.cab to your device and installing it?
  • 02-22-2008 11:22 In reply to

    Re: Unable to adjust RAPI Security Policy

    I have the same problem. I use Rapi.CreateProcess and Rapi.CopyFileFromDevice in my C# application without incident, so I'm assuming it's not a security issue... at least I think not.

     System.ArgumentNullException was unhandled
      Message="Value cannot be null.\r\nParameter name: source"
      Source="mscorlib"
      ParamName="source"
      StackTrace:
           at System.Runtime.InteropServices.Marshal.CopyToManaged(IntPtr source, Object destination, Int32 startIndex, Int32 length)
           at System.Runtime.InteropServices.Marshal.Copy(IntPtr source, Byte[] destination, Int32 startIndex, Int32 length)
           at OpenNETCF.Desktop.Communication.RAPI.Invoke(String DLLPath, String FunctionName, Byte[] InputData, Byte[]& OutputData)

    I wonder if this is a problem with my DLL path, possibly creating a DLL that just does not work properly, etc... (my DLL experience is rather limited).

  • 02-22-2008 11:57 In reply to

    • ctacke
    • OpenNETCF Staff
    • Top 10 Contributor
    • Joined on 07-27-2007
    • Indiana
    • Posts 1,868

    Re: Unable to adjust RAPI Security Policy

    This specific error indicates you are calling RAPI.Invoke and sending in a null for InputData, which it doesn't like.  This has nothing to do with CreateProcess or  CopyFileFromDevice.

     
     

    Filed under:
  • 02-22-2008 13:16 In reply to

    Re: Unable to adjust RAPI Security Policy

    ctacke:

    This specific error indicates you are calling RAPI.Invoke and sending in a null for InputData, which it doesn't like.  This has nothing to do with CreateProcess or  CopyFileFromDevice.

    I was only saying that my other RAPI functions work fine due to the security issues brought up earlier in the thread, unless RAPI.Invoke has some special security considerations.

    I'll take a look at my InputData.

  • 03-05-2008 10:50 In reply to

    • anguli
    • Top 500 Contributor
    • Joined on 03-05-2008
    • Posts 1

    Re: Unable to adjust RAPI Security Policy

    WorkingDave,

     Did you ever resolve the issue with ArgumentNullException? I've tried to resolve the issue by signed the dll and preallocating the InputData.

     The code is as it was posted for retrieving the device id via Rapi.Invoke. Idon't understand why it won't work for me.

     Thanks!

     

Page 1 of 1 (13 items)