Yup, you are tight , iwas jsut able to extend and use it directly... :)
venkat swaminathan
Posts
-
Extending named server overlapped IO -
Extending named server overlapped IOI am trying to implement a service provider to connect with a hardware device. request some suggestion on my approach and ideas to implement a robust system. Mentioned are the raised requirements 0. Receive data from other EXE process 1. To process received Q information. 2. Asynchronously send information on some failure. TO implement the mentioned system: 1. Selected 2 named pipe (commandRecv & commandSend) 2. CommandRecv pipe will be used as "Named Pipe Server Using Overlapped" I/O" 3. commandSend pipe will be used for sending the processed information. 4. commandSend will also need to send all the async messages from service provider to connected application. On init system will create a thread to hold connection instance of commandSend pipe.After creating thread instance commandRecv pipe will be set to overlapped I/O mode and process recieve queue information.
This is the code which i am trying to extend:
<pre>#include <windows.h>
#include <stdio.h>
#include <tchar.h>
//#include <strsafe.h>//#include <glib.h>
#define CONNECTING_STATE 0
#define READING_STATE 1
#define WRITING_STATE 2
#define INSTANCES 4
#define PIPE_TIMEOUT 5000
#define BUFSIZE 4096typedef struct
{
OVERLAPPED oOverlap;
HANDLE hPipeInst;
TCHAR chRequest[BUFSIZE];
DWORD cbRead;
TCHAR chReply[BUFSIZE];
DWORD cbToWrite;
DWORD dwState;
BOOL fPendingIO;
int processId;
} PIPEINST, *LPPIPEINST;typedef struct
{
char appName[256];
int processId;
}PIPEHANDSHAKE;VOID DisconnectAndReconnect(DWORD);
BOOL ConnectToNewClient(HANDLE, LPOVERLAPPED);
VOID GetAnswerToRequest(LPPIPEINST);PIPEINST Pipe[INSTANCES];
HANDLE hEvents[INSTANCES];HANDLE responsePipeHandle[INSTANCES];
DWORD WINAPI InstanceThread(LPVOID);
HANDLE hPipeHandles[10];
PULONG s;LPTSTR lpszPipename = TEXT("\\\\.\\pipe\\mynamedpipe");
LPTSTR lpszResponsePipe = TEXT("\\\\.\\pipe\\mynamedpipe1");//GHashTable* hash;
int responsePipeConnectionHandler(VOID)
{
BOOL fConnected = FALSE;
DWORD dwThreadId = 0;
HANDLE hPipe = INVALID_HANDLE_VALUE, hThread = NULL;
int cbBytesRead;
INT threadCount=0;
//hash = g_hash_table_new(g_str_hash, g_str_equal);
char bufferSize[512];
for (;;)
{
_tprintf( TEXT("\nPipe Server: Main thread awaiting client connection on %s\n"), lpszResponsePipe);
hPipe = CreateNamedPipe(
lpszResponsePipe, -
DLL creation process in windows application with CEN XFSNo problem , I will try some option too...
-
DLL creation process in windows application with CEN XFSXFSMANAGER INSTALLER: ftp://ftp.cencenelec.eu/CEN/WhatWeDo/Fields/ICT/eBusiness/WS/XFS/CWA15748/XFS310SDKInstall.zip
That is the libray link.
-
DLL creation process in windows application with CEN XFSIf possible can you just try downloading the code and check with your MS VS version??
-
DLL creation process in windows application with CEN XFSNO luck still.... :(
-
DLL creation process in windows application with CEN XFSYes, I sm trying to follow the same. but still it is doing no good. https://drive.google.com/file/d/0B60pejPe6yiSejRGQ3JnLUl4dzA/view[^] The link contains the project ref files i made sure all files are CPP and Extern C just for the headers. What else should i look ifor?? is there some settings that i should set in VS 2010 Express
-
DLL creation process in windows application with CEN XFSThanks your tip help me to start some invetigation.All these days we were with LINUX. Migrating to windows seems little difficult for me. Where should :
extern "C"
{}
</pre>
be added??
Because SPITesh.H, the code has the expected tag...
#ifdef __cplusplus
extern "C" {
#endif
SPITEST_API HRESULT WINAPI WFPCancelAsyncRequest(HSERVICE hService, REQUESTID RequestID);
SPITEST_API HRESULT WINAPI WFPClose(HSERVICE hService, HWND hWnd, REQUESTID ReqID);
SPITEST_API HRESULT WINAPI WFPDeregister(HSERVICE hService, DWORD dwEventClass, HWND hWndReg, HWND hWnd, REQUESTID ReqID);
SPITEST_API HRESULT WINAPI WFPExecute(HSERVICE hService, DWORD dwCommand, LPVOID lpCmdData, DWORD dwTimeOut, HWND hWnd, REQUESTID ReqID);
SPITEST_API HRESULT WINAPI WFPGetInfo(HSERVICE hService, DWORD dwCategory, LPVOID lpQueryDetails, DWORD dwTimeOut, HWND hWnd, REQUESTID ReqID);
SPITEST_API HRESULT WINAPI WFPLock(HSERVICE hService, DWORD dwTimeOut, HWND hWnd, REQUESTID ReqID);
SPITEST_API HRESULT WINAPI WFPOpen(HSERVICE hService, LPSTR lpszLogicalName, HAPP hApp, LPSTR lpszAppID, DWORD dwTraceLevel, DWORD dwTimeOut, HWND hWnd, REQUESTID ReqID, HPROVIDER hProvider, DWORD dwSPIVersionsRequired, LPWFSVERSION lpSPIVersion, DWORD dwSrvcVersionsRequired, LPWFSVERSION lpSrvcVersion);
SPITEST_API HRESULT WINAPI WFPRegister(HSERVICE hService, DWORD dwEventClass, HWND hWndReg, HWND hWnd, REQUESTID ReqID);
SPITEST_API HRESULT WINAPI WFPSetTraceLevel(HSERVICE hService, DWORD dwTraceLevel);
SPITEST_API HRESULT WINAPI WFPUnloadService();
SPITEST_API HRESULT WINAPI WFPUnlock(HSERVICE hService, HWND hWnd, REQUESTID ReqID);
#ifdef __cplusplus
};
#endif -
DLL creation process in windows application with CEN XFSAlso i see some difference in Sp's DLL which i created and actual working vendors DLL
Difference noted using PE studio's exported sysmbols option
DLL Created by ME:_WFPCancelAsyncRequest@8,-,1,-,-,.rdata:0x00001096
_WFPClose@12,-,2,-,-,.rdata:0x00001005
_WFPDeregister@20,-,3,-,-,.rdata:0x00001140
_WFPExecute@24,-,4,-,-,.rdata:0x00001131
_WFPGetInfo@24,-,5,-,-,.rdata:0x000010EB
_WFPLock@16,-,6,-,-,.rdata:0x00001023
_WFPOpen@52,-,7,-,-,.rdata:0x0000102D
_WFPRegister@20,-,8,-,-,.rdata:0x00001073
_WFPSetTraceLevel@8,-,9,-,-,.rdata:0x0000113B
_WFPUnloadService@0,-,10,-,-,.rdata:0x0000100A
_WFPUnlock@12,-,11,-,-,.rdata:0x00001082Vendor created DLL:
WFPCancelAsyncRequest,-,1,-,-,.rdata:0x0000C450
WFPClose,-,2,-,-,.rdata:0x0000C6E0
WFPDeregister,-,3,-,-,.rdata:0x0000C7F0
WFPExecute,-,4,-,-,.rdata:0x0000C970
WFPGetInfo,-,5,-,-,.rdata:0x0000DFA0
WFPLock,-,6,-,-,.rdata:0x0000E490
WFPOpen,-,7,-,-,.rdata:0x0000C030
WFPRegister,-,8,-,-,.rdata:0x0000E590
WFPSetTraceLevel,-,9,-,-,.rdata:0x0000E710
WFPUnloadService,-,10,-,-,.rdata:0x0000E770
WFPUnlock,-,11,-,-,.rdata:0x0000E8F0What is the difference.Does export method differ??
-
DLL creation process in windows application with CEN XFSSo, you suspect this might the issue with SP code which i am currently working with??.
-
DLL creation process in windows application with CEN XFSHi To say i am very noob to windows programming world. We are trying to develop windows application + device driver with CEN XFS compliance. http://en.wikipedia.org/wiki/CEN/XFS simple architectural flow:
Windows Application | \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ | XFS APIs | (CEN/XFS SDK DLL) | | | XFS SPIs | |\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_|---XFS Manager | | Service providers (SP) (DEVICE DRIVER)
To understand the SP's functionality, we recently took one of the device vendors SP's DLL for accessing their device and we were able to successfully communicate with their device using our windows application(Eclipse MINGW based). Then we started to check for some sample SP source in internet to try our implementation. (https://drive.google.com/file/d/0B60pejPe6yiSejRGQ3JnLUl4dzA/view) With the linked source we were able to compile and create an output DLL. But , when we tried to access the SP, I always return error. With windows sample application, we just tried to open the device with call (WFSOPEN) which always returned (-15 WFS_ERR_INTERNAL_ERROR ) or (-29 WFS_ERR_INVALID_SERVPROV)
Trial FLow 1 : Application Call to manager: hResult = WFSOpen( "QuantumT", hApp,lpszAppID, dwTraceLevel,dwTimeOut,VER\_SPI\_REQUIRE,&SrvcVersion,&SPIVersion,&hService); manager translates WFSOPEN call to SP's WFPOPEN call: HRESULT WINAPI WFPOpen(HSERVICE hService, LPSTR lpszLogicalName, HAPP hApp, LPSTR lpszAppID, DWORD dwTraceLevel, DWORD dwTimeOut, HWND hWnd, REQUESTID ReqID, HPROVIDER hProvider, DWORD dwSPIVersionsRequired, LPWFSVERSION lpSPIVersion, DWORD dwSrvcVersionsRequired, LPWFSVERSION lpSrvcVersion) With above call flow I get (-29 WFS\_ERR\_INVALID\_SERVPROV) as an error for my application
Trial FLow 2 (Just removed WINAPI interface for WFPOPEN in SP):
Application Call to manager:
hResult = WFSOpen("QuantumT",hApp,lpszAppID,dwTraceLevel,dwTimeOut,VER_SPI_REQUIRE,&SrvcVersion,&SPIVersion,&hService);
manager translates WFSOPEN call to SP's WFPOPEN call
HRESULT WFPOpen(HSERVICE hServi
-
COM PORT SETTING THROUGH C# IDEhi all i am a newbie to C# and i am trying to devlop a application for SENDING SMS through PC and i am trying to decode a application (myphoneexplorer) using portmonitor. now i am in a portion of understanding the handling the setting of COMPORT. this is the portmon result IRP_MJ_CREATE Options: Open IOCTL_SERIAL_SET_BAUD_RATE Rate: 921600 IOCTL_SERIAL_SET_LINE_CONTROL StopBits: 1 Parity: NONE WordLength: 8 IOCTL_SERIAL_SET_CHAR EOF:0 ERR:0 BRK:0 EVT:0 XON:0 XOFF:0 IOCTL_SERIAL_SET_HANDFLOW Shake:1 Replace:40 XonLimit:0 XoffLimit:0 IOCTL_SERIAL_SET_QUEUE_SIZE InSize: 16384 OutSize: 16384 IOCTL_SERIAL_SET_QUEUE_SIZE InSize: 16384 OutSize: 16384 IOCTL_SERIAL_SET_WAIT_MASK Mask: RXCHAR IOCTL_SERIAL_SET_TIMEOUTS RI:20 RM:10 RC:2000 WM:10 WC:200 Can somebody guideon this explain the pasted content and how to set it through C# Regards Venkat.S