From Scanuser interfase

Hi friends:
As a third year student, I was looking at the scanuser example from IFS kit…a consola application but i was thinking in a win32 implementation…so here is my code…

A problem is when I like to connect to port
…at OnDlgCommunication_ConnectDriver(…)

Thanking you in advance for your kind of help and time; I am…

const PWSTR ScannerPortName = L"\ScannerPort";
typedef struct _SCANNER_THREAD_CONTEXT {
HANDLE Port;
HANDLE Completion;
} SCANNER_THREAD_CONTEXT, *PSCANNER_THREAD_CONTEXT;

LRESULT OnDlgCommunication_ConnectDriver(hDlgCommunication, wParam, lParam)
{
HRESULT hresult;
HANDLE port, completion;
SCANNER_THREAD_CONTEXT context;
hresult = FilterConnectCommunicationPort ( ScannerPortName,
0,
NULL,
0,
NULL,
&port );
if (IS_ERROR ( hresult ))
{
MessageBox(NULL, “Cant not connect to port”, NULL, MB_ICONERROR| MB_SYSTEMMODAL);
return 2;
}
//
// Create a completion port to associate with this handle.
//
completion = CreateIoCompletionPort ( port,
NULL,
0,
0 );
if (completion == NULL)
{
MessageBox(NULL, “Error when creating a completion port”, NULL, MB_ICONERROR| MB_SYSTEMMODAL);
CloseHandle ( port );
return 3;
}

context.Port = port;
context.Completion = completion;
return hresult;
}

LRESULT CALLBACK DlgCommunication(HWND hDlgCommunication, UINT Msg, WPARAM wParam, LPARAM lParam)
{
switch(Msg)
{
case WM_INITDIALOG:
return TRUE;
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDC_CONNECT:
break;
return OnDlgCommunication_ConnectDriver(hDlgCommunication, wParam, lParam);




case IDC_EXIT:
DestroyWindow(hWndMainWin);
hWndMainWin = NULL;

return TRUE;
}
break;
case WM_CLOSE:
EndDialog(hDlgCommunication,0);

return FALSE;

}
return FALSE;
}

LRESULT CALLBACK WndProcedure(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
RECT rctMainWnd, rctToolbox;
switch(Msg)
{
case WM_SIZE:
GetClientRect(hWndMainWin, &rctMainWnd);
GetWindowRect(hWndFrame, &rctToolbox);
SetWindowPos(hWndFrame, HWND_TOP, rctMainWnd.left,
rctMainWnd.top,
rctMainWnd.right,
rctMainWnd.bottom,
SWP_NOACTIVATE | SWP_NOOWNERZORDER);
break;
case WM_DESTROY:
PostQuitMessage(WM_QUIT);
break;
default:
return DefWindowProc(hWndMainWin, Msg, wParam, lParam);
}
return 0;
}

INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
MSG Msg;
WNDCLASSEX WndClsEx;

WndClsEx.cbSize = sizeof(WNDCLASSEX);
WndClsEx.style = CS_HREDRAW | CS_VREDRAW;
WndClsEx.lpfnWndProc = WndProcedure;
WndClsEx.cbClsExtra = 0;
WndClsEx.cbWndExtra = 0;
WndClsEx.hIcon = LoadIcon(NULL, IDI_APPLICATION);


RegisterClassEx(&WndClsEx);
hInst = hInstance;
// Create the window object
hWndMainWin = CreateWindow(windows_class,
WndName,
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
NULL,
NULL,
hInstance,
NULL);

if( !hWndMainWin ) return 0;
hWndFrame = CreateDialog(hInst, MAKEINTRESOURCE(IDD_INTERFACE), hWndMainWin, (DLGPROC)DlgCommunication);

ShowWindow (hWndFrame, SW_SHOW);
ShowWindow(hWndMainWin, SW_SHOWNORMAL);

while( GetMessage(&Msg, NULL, 0, 0) )
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
return Msg.wParam;
}


?Sobre autos lo sabemos todo, y te podemos ayudar!
Ya sea para comprar, vender o comparar autos, entra en el canal de autos de Terra.com
Te aconsejamos, te informamos y te mostramos todo lo que necesitas saber.
http://www.terra.com/autos

Can you say more about your problem? What exact not work? And why you make call

case IDC_CONNECT:
break;
return OnDlgCommunication_ConnectDriver(hDlgCommunication, wParam, lParam);

after break operator???

Best regards,
Fisyuk Victor
EMail/MSN: xxxxx@rambler.ru
Web: http://rockdbg.siteburg.com

“rob_fc” wrote in message news:xxxxx@ntfsd…
Hi friends:
As a third year student, I was looking at the scanuser example from IFS kit…a consola application but i was thinking in a win32 implementation…so here is my code…

A problem is when I like to connect to port
…at OnDlgCommunication_ConnectDriver(…)

Thanking you in advance for your kind of help and time; I am…

const PWSTR ScannerPortName = L"\ScannerPort";
typedef struct _SCANNER_THREAD_CONTEXT {
HANDLE Port;
HANDLE Completion;
} SCANNER_THREAD_CONTEXT, *PSCANNER_THREAD_CONTEXT;

LRESULT OnDlgCommunication_ConnectDriver(hDlgCommunication, wParam, lParam)
{
HRESULT hresult;
HANDLE port, completion;
SCANNER_THREAD_CONTEXT context;
hresult = FilterConnectCommunicationPort ( ScannerPortName,
0,
NULL,
0,
NULL,
&port );
if (IS_ERROR ( hresult ))
{
MessageBox(NULL, “Cant not connect to port”, NULL, MB_ICONERROR| MB_SYSTEMMODAL);
return 2;
}
//
// Create a completion port to associate with this handle.
//
completion = CreateIoCompletionPort ( port,
NULL,
0,
0 );
if (completion == NULL)
{
MessageBox(NULL, “Error when creating a completion port”, NULL, MB_ICONERROR| MB_SYSTEMMODAL);
CloseHandle ( port );
return 3;
}

context.Port = port;
context.Completion = completion;
return hresult;
}

LRESULT CALLBACK DlgCommunication(HWND hDlgCommunication, UINT Msg, WPARAM wParam, LPARAM lParam)
{
switch(Msg)
{
case WM_INITDIALOG:
return TRUE;
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDC_CONNECT:
break;
return OnDlgCommunication_ConnectDriver(hDlgCommunication, wParam, lParam);




case IDC_EXIT:
DestroyWindow(hWndMainWin);
hWndMainWin = NULL;

return TRUE;
}
break;
case WM_CLOSE:
EndDialog(hDlgCommunication,0);

return FALSE;

}
return FALSE;
}

LRESULT CALLBACK WndProcedure(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
RECT rctMainWnd, rctToolbox;
switch(Msg)
{
case WM_SIZE:
GetClientRect(hWndMainWin, &rctMainWnd);
GetWindowRect(hWndFrame, &rctToolbox);
SetWindowPos(hWndFrame, HWND_TOP, rctMainWnd.left,
rctMainWnd.top,
rctMainWnd.right,
rctMainWnd.bottom,
SWP_NOACTIVATE | SWP_NOOWNERZORDER);
break;
case WM_DESTROY:
PostQuitMessage(WM_QUIT);
break;
default:
return DefWindowProc(hWndMainWin, Msg, wParam, lParam);
}
return 0;
}

INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
MSG Msg;
WNDCLASSEX WndClsEx;

WndClsEx.cbSize = sizeof(WNDCLASSEX);
WndClsEx.style = CS_HREDRAW | CS_VREDRAW;
WndClsEx.lpfnWndProc = WndProcedure;
WndClsEx.cbClsExtra = 0;
WndClsEx.cbWndExtra = 0;
WndClsEx.hIcon = LoadIcon(NULL, IDI_APPLICATION);




RegisterClassEx(&WndClsEx);
hInst = hInstance;
// Create the window object
hWndMainWin = CreateWindow(windows_class,
WndName,
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
NULL,
NULL,
hInstance,
NULL);

if( !hWndMainWin ) return 0;
hWndFrame = CreateDialog(hInst, MAKEINTRESOURCE(IDD_INTERFACE), hWndMainWin, (DLGPROC)DlgCommunication);

ShowWindow (hWndFrame, SW_SHOW);
ShowWindow(hWndMainWin, SW_SHOWNORMAL);

while( GetMessage(&Msg, NULL, 0, 0) )
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
return Msg.wParam;
}

___________________________________________________
?Sobre autos lo sabemos todo, y te podemos ayudar!
Ya sea para comprar, vender o comparar autos, entra en el canal de autos de Terra.com
Te aconsejamos, te informamos y te mostramos todo lo que necesitas saber.
http://www.terra.com/autos

Excuse me…that break is out of the problem…

I have a main window and a child dialog resource on it, with a command button named IDC_CONNECT to connect the port to minifilter scanner example from IFS kit

LRESULT OnDlgCommunication_ConnectDriver(hDlgCommunication, wParam, lParam)
{
HRESULT hresult;
HANDLE port, completion;
SCANNER_THREAD_CONTEXT context;
hresult = FilterConnectCommunicationPort ( ScannerPortName,
0,
NULL,
0,
NULL,
&port );
if (IS_ERROR ( hresult ))
{
MessageBox(NULL, “No se puede conectar al puerto”, NULL, MB_ICONERROR| MB_SYSTEMMODAL);
return 2;
}
//
// Create a completion port to associate with this handle.
//
completion = CreateIoCompletionPort ( port,
NULL,
0,
0 );
if (completion == NULL)
{
MessageBox(NULL, “Error al crear completion port”, NULL, MB_ICONERROR| MB_SYSTEMMODAL);
CloseHandle ( port );
return 3;
}
// printf( “Scanner: Port = 0x%p Completion = 0x%p\n”, port, completion );
context.Port = port;
context.Completion = completion;
return hresult;
}

LRESULT CALLBACK DlgCommunication(HWND hDlgCommunication, UINT Msg, WPARAM wParam, LPARAM lParam)
{
switch(Msg)
{
case WM_INITDIALOG:
return TRUE;
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDC_CONNECT:

return OnDlgCommunication_ConnectDriver(hDlgCommunication, wParam, lParam);

case IDC_EXIT:
DestroyWindow(hWndMainWin);
hWndMainWin = NULL;

return TRUE;
}
break;
case WM_CLOSE:
EndDialog(hDlgCommunication,0);

return FALSE;

}
return FALSE;
}


?Sobre autos lo sabemos todo, y te podemos ayudar!
Ya sea para comprar, vender o comparar autos, entra en el canal de autos de Terra.com
Te aconsejamos, te informamos y te mostramos todo lo que necesitas saber.
http://www.terra.com/autos

Hi,
I can’t understande your problem. What exact not work in your program?

Best regards,
Fisyuk Victor
EMail/MSN: xxxxx@rambler.ru
Web: http://rockdbg.siteburg.com

“rob_fc” wrote in message news:xxxxx@ntfsd…
Excuse me…that break is out of the problem…

I have a main window and a child dialog resource on it, with a command button named IDC_CONNECT to connect the port to minifilter scanner example from IFS kit

LRESULT OnDlgCommunication_ConnectDriver(hDlgCommunication, wParam, lParam)
{
HRESULT hresult;
HANDLE port, completion;
SCANNER_THREAD_CONTEXT context;
hresult = FilterConnectCommunicationPort ( ScannerPortName,
0,
NULL,
0,
NULL,
&port );
if (IS_ERROR ( hresult ))
{
MessageBox(NULL, “No se puede conectar al puerto”, NULL, MB_ICONERROR| MB_SYSTEMMODAL);
return 2;
}
//
// Create a completion port to associate with this handle.
//
completion = CreateIoCompletionPort ( port,
NULL,
0,
0 );
if (completion == NULL)
{
MessageBox(NULL, “Error al crear completion port”, NULL, MB_ICONERROR| MB_SYSTEMMODAL);
CloseHandle ( port );
return 3;
}
// printf( “Scanner: Port = 0x%p Completion = 0x%p\n”, port, completion );
context.Port = port;
context.Completion = completion;
return hresult;
}

LRESULT CALLBACK DlgCommunication(HWND hDlgCommunication, UINT Msg, WPARAM wParam, LPARAM lParam)
{
switch(Msg)
{
case WM_INITDIALOG:
return TRUE;
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDC_CONNECT:

return OnDlgCommunication_ConnectDriver(hDlgCommunication, wParam, lParam);

case IDC_EXIT:
DestroyWindow(hWndMainWin);
hWndMainWin = NULL;

return TRUE;
}
break;
case WM_CLOSE:
EndDialog(hDlgCommunication,0);

return FALSE;

}
return FALSE;
}

___________________________________________________
?Sobre autos lo sabemos todo, y te podemos ayudar!
Ya sea para comprar, vender o comparar autos, entra en el canal de autos de Terra.com
Te aconsejamos, te informamos y te mostramos todo lo que necesitas saber.
http://www.terra.com/autos

I can connect to port but the system hang up…

De:xxxxx@lists.osr.com

Para:“Windows File Systems Devs Interest List” xxxxx@lists.osr.com

Copia:

Fecha:Thu, 23 Mar 2006 17:47:46 +0200

Asunto:Re:[ntfsd] Re:From Scanuser interfase

Hi,
I can’t understande your problem. What exact not work in your program?

Best regards,
Fisyuk Victor
EMail/MSN: xxxxx@rambler.ru
Web: http://rockdbg.siteburg.com

“rob_fc” wrote in message news:xxxxx@ntfsd…
> Excuse me…that break is out of the problem…
>
> I have a main window and a child dialog resource on it, with a command button named IDC_CONNECT to connect the port to minifilter scanner example from IFS kit
>
>
> LRESULT OnDlgCommunication_ConnectDriver(hDlgCommunication, wParam, lParam)
{
HRESULT hresult;
HANDLE port, completion;
SCANNER_THREAD_CONTEXT context;
> hresult = FilterConnectCommunicationPort ( ScannerPortName,
0,
NULL,
0,
NULL,
&port );
> if (IS_ERROR ( hresult ))
{
> MessageBox(NULL, “No se puede conectar al puerto”, NULL, MB_ICONERROR| MB_SYSTEMMODAL);
return 2;
}
//
// Create a completion port to associate with this handle.
//
> completion = CreateIoCompletionPort ( port,
NULL,
0,
0 );
> if (completion == NULL)
{
MessageBox(NULL, “Error al crear completion port”, NULL, MB_ICONERROR| MB_SYSTEMMODAL);
CloseHandle ( port );
return 3;
}
> // printf( “Scanner: Port = 0x%p Completion = 0x%p\n”, port, completion );
> context.Port = port;
context.Completion = completion;
return hresult;
}
>
LRESULT CALLBACK DlgCommunication(HWND hDlgCommunication, UINT Msg, WPARAM wParam, LPARAM lParam)
{
switch(Msg)
{
case WM_INITDIALOG:
return TRUE;
> case WM_COMMAND:
switch(LOWORD(wParam))
{
> case IDC_CONNECT:

return OnDlgCommunication_ConnectDriver(hDlgCommunication, wParam, lParam);

case IDC_EXIT:
DestroyWindow(hWndMainWin);
hWndMainWin = NULL;

return TRUE;
}
> break;
case WM_CLOSE:
EndDialog(hDlgCommunication,0);

return FALSE;

> }
> return FALSE;
}


?Sobre autos lo sabemos todo, y te podemos ayudar!
Ya sea para comprar, vender o comparar autos, entra en el canal de autos de Terra.com
Te aconsejamos, te informamos y te mostramos todo lo que necesitas saber.
http://www.terra.com/autos


Questions? First check the IFS FAQ at https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

?Sobre autos lo sabemos todo, y te podemos ayudar!
Ya sea para comprar, vender o comparar autos, entra en el canal de autos de Terra.com
Te aconsejamos, te informamos y te mostramos todo lo que necesitas saber.
http://www.terra.com/autos