Click here to Skip to main content
15,892,737 members
Home / Discussions / C#
   

C#

 
QuestionCursor apply registry changes [modified] Pin
rick055618-Sep-09 16:15
rick055618-Sep-09 16:15 
QuestionWeb service notification Pin
Xmen Real 18-Sep-09 15:48
professional Xmen Real 18-Sep-09 15:48 
QuestionHow to convert excel file to xml file to format DTD! Pin
Khuc Manh Thao18-Sep-09 15:42
Khuc Manh Thao18-Sep-09 15:42 
AnswerRe: How to convert excel file to xml file to format DTD! Pin
Khuc Manh Thao21-Sep-09 22:58
Khuc Manh Thao21-Sep-09 22:58 
Questionis it xml technology Pin
Mohamed El-Wehishy18-Sep-09 15:24
Mohamed El-Wehishy18-Sep-09 15:24 
AnswerRe: is it xml technology Pin
Luc Pattyn18-Sep-09 15:28
sitebuilderLuc Pattyn18-Sep-09 15:28 
AnswerRe: is it xml technology Pin
Mohamed El-Wehishy18-Sep-09 15:40
Mohamed El-Wehishy18-Sep-09 15:40 
QuestionFilterSendMessage - talking to a MiniFilter driver Pin
Søren Staun Jørgensen18-Sep-09 11:32
Søren Staun Jørgensen18-Sep-09 11:32 
Hi,
I'm trying to talk to a mini-filter driver using p-invoke, but cannot make this function return successfully:

C/C++ function:
HRESULT WINAPI FilterSendMessage(
    IN HANDLE  hPort,
    IN LPVOID  lpInBuffer OPTIONAL,
    IN DWORD  dwInBufferSize,
    IN OUT LPVOID  lpOutBuffer OPTIONAL,
    IN DWORD  dwOutBufferSize,
    OUT LPDWORD  lpBytesReturned
    );

C# function:
[DllImport("FltLib", CallingConvention = CallingConvention.Winapi, CharSet = CharSet.Auto)]
public static extern int FilterSendMessage(
   [In] SafeFileHandle hPort,
   [In] IntPtr lpInBuffer,
   [In] int dwInBufferSize,
   [In, Out] IntPtr lpOutBuffer,
   [In] int dwOutBufferSize,
   [Out] out int lpBytesReturned);

My problem is that whenever I call this function (in C# code) it returns 0x80070057 (Invalid parameter). The handle to the port is valid, and I have received a message from the filter just before this method is called.

I'm using it like this to send a message to the filter:

int bufferSize = Marshal.SizeOf(myBuffer);
IntPtr inBuffer = Marshal.AllocHGlobal(bufferSize);
int bytesReturned = 0;

Marshal.StructureToPtr(myBuffer, inBuffer, true);

int res = FltLib.FilterSendMessage(_hPort, inBuffer, bufferSize,
    IntPtr.Zero, 0, out bytesReturned);

// res = 0x80070057


Any help appreciated, thanks...

Soren
AnswerRe: FilterSendMessage - talking to a MiniFilter driver Pin
Søren Staun Jørgensen18-Sep-09 11:45
Søren Staun Jørgensen18-Sep-09 11:45 
Questionunmanaged code data type equivalents in c# Pin
akhanal18-Sep-09 11:00
akhanal18-Sep-09 11:00 
AnswerRe: unmanaged code data type equivalents in c# Pin
Christian Graus18-Sep-09 11:39
protectorChristian Graus18-Sep-09 11:39 
GeneralRe: unmanaged code data type equivalents in c# Pin
Luc Pattyn18-Sep-09 11:47
sitebuilderLuc Pattyn18-Sep-09 11:47 
GeneralRe: unmanaged code data type equivalents in c# Pin
Christian Graus18-Sep-09 12:16
protectorChristian Graus18-Sep-09 12:16 
GeneralRe: unmanaged code data type equivalents in c# Pin
Matt Meyer18-Sep-09 12:21
Matt Meyer18-Sep-09 12:21 
GeneralRe: unmanaged code data type equivalents in c# Pin
Luc Pattyn18-Sep-09 12:32
sitebuilderLuc Pattyn18-Sep-09 12:32 
GeneralRe: unmanaged code data type equivalents in c# Pin
akhanal19-Sep-09 6:44
akhanal19-Sep-09 6:44 
QuestionHelp with getting data from web service into a named pipe stream Pin
AndyASPVB18-Sep-09 10:20
AndyASPVB18-Sep-09 10:20 
QuestionDoes destination PC need installing Crystal Report ? Pin
Mohammad Dayyan18-Sep-09 10:01
Mohammad Dayyan18-Sep-09 10:01 
QuestionWork on a new thread locks the GUI Pin
SimpleData18-Sep-09 9:23
SimpleData18-Sep-09 9:23 
AnswerRe: Work on a new thread locks the GUI Pin
Luc Pattyn18-Sep-09 9:48
sitebuilderLuc Pattyn18-Sep-09 9:48 
GeneralRe: Work on a new thread locks the GUI Pin
Manas Bhardwaj18-Sep-09 9:52
professionalManas Bhardwaj18-Sep-09 9:52 
GeneralRe: Work on a new thread locks the GUI Pin
SimpleData18-Sep-09 10:00
SimpleData18-Sep-09 10:00 
GeneralRe: Work on a new thread locks the GUI Pin
Luc Pattyn18-Sep-09 10:03
sitebuilderLuc Pattyn18-Sep-09 10:03 
GeneralRe: Work on a new thread locks the GUI Pin
SimpleData18-Sep-09 10:06
SimpleData18-Sep-09 10:06 
GeneralRe: Work on a new thread locks the GUI Pin
SimpleData18-Sep-09 10:20
SimpleData18-Sep-09 10:20 

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.