wrappingduke 0 Newbie Poster

Hello,

Attempting to use vb6 to call CeRapiInvoke to execute a process on a WM device.

However, I'm having some difficulty invoking this function. The desktop (VB6) application used to call CeRapiInvoke unconditionally terminates when attempting to run the process in Block mode.

I'm using passing the parameter IRAPIStream a vbNull or other type of Null value.

Here's a sample of the code:
VB code:

'declaration of function
Declare Function CeRapiInvoke Lib "rapi.dll" ( _
ByVal pDllPath As String, _
ByVal pFunctionName As String, _
ByVal cbInput As Long, _
ByVal pInput As Byte, _
ByVal pcbOutput As Long, _
ByVal ppOutput As Byte, _
ByVal ppIRAPIStream As Any, _
ByVal dwReserved As Long) As Long

    Dim ppInput(50) As Byte
    Dim ppOutput(50) As Byte
    Dim pcbOutput As Long
    Dim pcbInput As Long

        ppInput(1) = CByte(0)
        pcbInput = LenB(ppInput(1))
        
        ppOutput(1) = CByte(0)
        pcbOutput = LenB(ppOutput(1))
        
        'remotely execute routine by invoking custom DLL
        'use Block mode
        lRetVal = CeRapiInvoke( _
            StrConv("\Storage Card\RunFlatFiles.dll", vbUnicode),  _
            StrrConv("Function1", vbUnicode), _
            pcbInput, ppInput(1), _
            pcbOutput, ppOutput(1), vbNull, 0)

Here's the code used C++ DLL

#define DllExport __declspec (dllexport) 

// c++ file
extern "C" __declspec(dllexport) void Function1(LPCWSTR pDllPath, LPCWSTR
   pFunctionName, DWORD cbInput, BYTE *pInput, DWORD *pcbOutput,
   BYTE **ppOutput, IRAPIStream **ppIRAPIStream, DWORD dwReserved)
{

  char sArgs[] = "testpath";

 CreateProcess((LPCTSTR)"\\Storage Card\\bin\\cvm.exe", 
  (LPTSTR)sArgs, NULL, NULL, false, 0, NULL, NULL,
  NULL, &typProcessInfo);
}

any help is appreciated