Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2006-11

C API call problem under WinCE

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Gabor Boros

Hi,

If I start the test application on the WinCE device the result is: "project1.exe is not a valid Windows CE application." If I comment out the SCAN_FindFirst call, the application run properly. See below for the C header, and the test app.
Any suggestions?

Many Thanks!
Gabor

The C header file:

typedef struct tagSTRUCT_INFO
{
     DWORD dwAllocated;
     DWORD dwUsed;
} STRUCT_INFO;
typedef struct tagSCAN_FINDINFO
{
            STRUCT_INFO     StructInfo;
            TCHAR                   szDeviceName[MAX_DEVICE_NAME];
            TCHAR                   szPortName[MAX_DEVICE_NAME];
            TCHAR                   szFriendlyName[MAX_PATH];
            TCHAR                   szRegistryBasePath[MAX_PATH];
} SCAN_FINDINFO;
DWORD SCAN_FindFirst(LPSCAN_FINDINFO lpScanFindInfo,LPHANDLE lphFindHandle);

The test application:

program test;
{$apptype console}
uses Windows;
const
   E_SCN_SUCCESS=0;
   MAX_DEVICE_NAME=6;
{$IFDEF FPC}
{$PACKRECORDS C}
{$ENDIF}
type
   tagSTRUCT_INFO = record
     dwAllocated : DWORD;
     dwUsed : DWORD;
   end;
   STRUCT_INFO = tagSTRUCT_INFO;
   tagSCAN_FINDINFO = record
     StructInfo : STRUCT_INFO;
       szDeviceName : array[0..(MAX_DEVICE_NAME)-1] of TCHAR;
       szPortName : array[0..(MAX_DEVICE_NAME)-1] of TCHAR;
       szFriendlyName : array[0..(MAX_PATH)-1] of TCHAR;
       szRegistryBasePath : array[0..(MAX_PATH)-1] of TCHAR;
     end;
   SCAN_FINDINFO = tagSCAN_FINDINFO;
   LPSCAN_FINDINFO = ^SCAN_FINDINFO;
   function SCAN_FindFirst(lpScanFindInfo:LPSCAN_FINDINFO;
lphFindHandle:LPHANDLE):DWORD;cdecl;external 'SCNAPI32.DLL';
var
   lphFindHandle:LPHANDLE;
   lpScanFindInfo:LPSCAN_FINDINFO;
begin
   SCAN_FindFirst(lpScanFindInfo,lphFindHandle);
end.

Reply by email