Click here to Skip to main content
16,006,378 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: problem Pin
Mekong River15-Apr-06 23:23
Mekong River15-Apr-06 23:23 
Question3D Globe Pin
spelltwister14-Apr-06 13:48
spelltwister14-Apr-06 13:48 
AnswerRe: 3D Globe Pin
Ed.Poore15-Apr-06 23:33
Ed.Poore15-Apr-06 23:33 
GeneralRe: 3D Globe Pin
spelltwister28-Apr-06 18:41
spelltwister28-Apr-06 18:41 
GeneralRe: 3D Globe Pin
Ed.Poore28-Apr-06 23:32
Ed.Poore28-Apr-06 23:32 
QuestionApplication Framework Pin
GtheMan14-Apr-06 12:30
GtheMan14-Apr-06 12:30 
AnswerRe: Application Framework Pin
GtheMan14-Apr-06 21:21
GtheMan14-Apr-06 21:21 
QuestionVC++ "Handle" type causing issues in .NET Pin
REnginear14-Apr-06 10:37
REnginear14-Apr-06 10:37 
Hello All,

We are developing applications based on a off-the-shelf PCI card using the PCI 9030 controller. The PCI9030 comes with the SDK to communicate to it, which has device drivers that compile as a DLL (PLXAPI.DLL) in VC++.

However in .NET, they fail on the 'Handle' data type. The Handle datatype is declared as: typedef void *HANDLE in VC++.

However, in .NET, the closest I can find is IntPtr or Integer. Both fail. The function always considers the handle as NULL if it is an integer and causes a System.NullReference.Exception if it is an intptr. Since we have VC++ that creates the DLL, I was able to go thru the function (PLXPCIDeviceOpen) and internally the handle does not match any datatype. Where are things going wrong?
I have pasted below both the .NET function prototype and the actual code of the function from the VC++


.NET

Public Declare Function DeviceOpen Lib "PLXAPI.DLL" Alias "PlxPciDeviceOpen" (ByRef Device As PCIDevice, ByRef PCIDevHandle As IntPtr) As Integer

VC++


RETURN_CODE
PlxPciDeviceOpen(
DEVICE_LOCATION *pDevice, //Device location is bus/slot/vendorid etc
HANDLE *pHandle // verified - can find the device.
)
{
U8 VerMajor;
U8 VerMinor;
U8 VerRevision;
U32 i;
char DriverName[25];
IOCTLDATA IoBuffer;
RETURN_CODE rc;

if ((pDevice == NULL) || (pHandle == NULL))
//if ( (pDevice == NULL))
return ApiNullParam;

// Get the Serial number of the device, if not provided
if (pDevice->SerialNumber[0] == '\0')
{

i = 0;

// Search for the device matching the criteria
rc =
PlxPciDeviceFind(
pDevice,
&i
);
if (rc != ApiSuccess)
{
*pHandle = NULL;

return rc;
}

}

// If provided, the SerialNumber is sufficient to open a device
sprintf(
DriverName,
DRIVER_PATH "%s",
pDevice->SerialNumber
);

// Open the device
*pHandle =
CreateFile(
DriverName,
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL,
OPEN_EXISTING,
FILE_FLAG_DELETE_ON_CLOSE,
NULL
);

if (*pHandle == INVALID_HANDLE_VALUE)
{
*pHandle = NULL;
return ApiInvalidDeviceInfo;

}

// Add the handle to the device list.
if (DeviceListAdd(
*pHandle,
pDevice
) == NULL)
{
CloseHandle(
*pHandle
);

*pHandle = NULL;

return ApiInsufficientResources;

}

// Verify the driver version
PlxDriverVersion(
*pHandle,
&VerMajor,
&VerMinor,
&VerRevision
);

// Make sure the driver matches the DLL
if ((VerMajor != PLX_SDK_VERSION_MAJOR) ||
(VerMinor != PLX_SDK_VERSION_MINOR) ||
(VerRevision != PLX_SDK_VERSION_REVISION))

// Get device data from driver
IoMessage(
*pHandle,
PLX_IOCTL_DEVICE_INIT,
&IoBuffer
);

// Copy device information
*pDevice = IoBuffer.u.MgmtData.u.Device;
// msgbox put here indicates that function gets here.
return ApiSuccess;
}

AnswerRe: VC++ "Handle" type causing issues in .NET Pin
Dave Kreskowiak14-Apr-06 12:06
mveDave Kreskowiak14-Apr-06 12:06 
GeneralRe: VC++ "Handle" type causing issues in .NET Pin
REnginear15-Apr-06 12:59
REnginear15-Apr-06 12:59 
GeneralRe: VC++ "Handle" type causing issues in .NET Pin
REnginear16-Apr-06 13:58
REnginear16-Apr-06 13:58 
QuestionDataset bound to combobox Pin
G7236014-Apr-06 9:28
G7236014-Apr-06 9:28 
AnswerRe: Dataset bound to combobox Pin
Dave Kreskowiak17-Apr-06 4:24
mveDave Kreskowiak17-Apr-06 4:24 
QuestionAdvice for tracking a recordset change - Hash Value? Pin
Brad6ft414-Apr-06 7:59
Brad6ft414-Apr-06 7:59 
AnswerRe: Advice for tracking a recordset change - Hash Value? Pin
Dave Kreskowiak14-Apr-06 8:26
mveDave Kreskowiak14-Apr-06 8:26 
GeneralRe: Advice for tracking a recordset change - Hash Value? Pin
Brad6ft414-Apr-06 8:47
Brad6ft414-Apr-06 8:47 
GeneralRe: Advice for tracking a recordset change - Hash Value? Pin
Dave Kreskowiak14-Apr-06 9:28
mveDave Kreskowiak14-Apr-06 9:28 
GeneralRe: Advice for tracking a recordset change - Hash Value? Pin
Brad6ft417-Apr-06 4:42
Brad6ft417-Apr-06 4:42 
GeneralRe: Advice for tracking a recordset change - Hash Value? Pin
Dave Kreskowiak17-Apr-06 12:29
mveDave Kreskowiak17-Apr-06 12:29 
GeneralRe: Advice for tracking a recordset change - Hash Value? Pin
Brad6ft422-Apr-06 6:33
Brad6ft422-Apr-06 6:33 
Questionobjectdatasource has no values to insert Pin
dr S.A.f.14-Apr-06 2:43
dr S.A.f.14-Apr-06 2:43 
AnswerRe: objectdatasource has no values to insert Pin
Steve Pullan14-Apr-06 3:50
Steve Pullan14-Apr-06 3:50 
GeneralRe: objectdatasource has no values to insert Pin
dr S.A.f.14-Apr-06 8:20
dr S.A.f.14-Apr-06 8:20 
QuestionVb 6 and access 2000 in LAN Pin
arunendra14-Apr-06 2:11
arunendra14-Apr-06 2:11 
AnswerRe: Vb 6 and access 2000 in LAN Pin
Dave Kreskowiak14-Apr-06 3:34
mveDave Kreskowiak14-Apr-06 3:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.