Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

144 Neutral

About Hermes

  • Rank
  1. Hi, Since i didn't find any relevant information about C++ win32 services, i put the core functions(C/C++ based) into a DLL and loaded them in a C# service. Here is the error i get when i try to start the service. "An unhandled exception of type 'System.TypeLoadException' occurred in Unknown Module. ............................................................. because the method InitServiceWrapper has no RVA. " I really don't know how to get arround this. Below is the C++ function i try to call from my service. It is supposed to load a driver void InitService() { // // open the device // if((hDevice = CreateFile( "\\\\.\\DRV", GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) { errNum = GetLastError(); if (errNum != ERROR_FILE_NOT_FOUND) { printf("CreateFile failed! ERROR_FILE_NOT_FOUND = %d\n", errNum); return ; } // // The driver is not started yet so let us the install the driver. // First setup full path to driver name. // if (!SetupDriverName(driverLocation)) { return ; } if (!ManageDriver(PARANOID_DEVICE_NAME, (LPCSTR)driverLocation, DRIVER_FUNC_INSTALL )) { printf("Unable to install driver. \n"); // // Error - remove driver. // ManageDriver(PARANOID_DEVICE_NAME, (LPCSTR)driverLocation, DRIVER_FUNC_REMOVE ); return; } } } Thanks !
  2. Hi, I've always used C# for creating and deploying windows services, but now i have to do it in C++. I tried using sc tool to register and start my service but no luck. Here's what i tried : >sc create [myservice name] binpath= [path to my service] this should make any registry settings needed.(or at least it should) When i try to start my service or view it in the service manager i see it doesn't exist at all. What am I doing wrong? What other options do i have? Thank you!
  3. Hi, I would like to develop a sentence recognition algorithm and i don't know how to implement it ....could you give me some ideas ..please ! Thanks a lot
  4. Hello guys! I am developing an applet media player but i'm facing problems with any avi files i tried so far. As it seems to me, the media player lacks codec information Failed to configure: com.sun.media.PlaybackEngine@19836ed IO exception: BasicPullParser: readBytes(): Reached end of stream while trying to read 4 bytes Error: Unable to realize com.sun.media.PlaybackEngine@19836ed FATAL ERROR: Failed to realize: failed to parse the input media. java.lang.Error: Failed to realize: failed to parse the input media. Thanks a lot
  5. Hi, I am very new to java and i'm trying to export something i made using SWT. Although i write anything that is necessary to the manifest (Class-Path: org.eclipse.swt......) and i copy the actual SWT jar into the working directory i get a NoClassPathDepth error message when i try to run my jar from command line. I am using Eclipse in case this is relevant and my classpath is set to ..\JAVA_HOME\lib THX
  6. Hi, Does any of you know how could i get the source code for a web page and have the possibilty to complete and submit forms automaticaly? Known libraries..? THX
  7. HI! Does anybody know a text segment recognition library that i could use for document translations. I want to make a software similar to TRADOS( used by translators worlwide.) Thanks a lot
  8. Sorry , that one was me ....
  9. Hi! I have an ASP.NET project that uses a WebService to connect to the SQL database.Everything was setted right,in terms of UserInterfacePermissions(to use dialog pop-up windows)and WebPermissions.The application worked fine until i installed a domain controller with windows authentification on the server. I get the following error message: "server was unable to process the request -->>File or assembly name lsb-6i9h.dll or one of its dependencies was not found ..The same goes with bd670h-r.dll" and anytime i try to process the request i get other dll names....This looks strange ...i really don't know why i get this permission constraints and missing dlls Thx !
  10. Hi! I have the following code that needs to be rewritten. I need to use another way of waithing the next thread to finish not using wile loops....I want something like WaitForSingleObject ....is there a way to do it in C# without dllImport...?? THX a lot Thread ExecThread = new Thread(new ThreadStart(SendDataToRemoteServer)); ExecThread.Start(); int TimeToWait=0; int IncomingTimeOut=120000; while ((ExecThread.IsAlive)&&(TimeToWait<IncomingTimeOut)) { Thread.Sleep(100); TimeToWait=TimeToWait+100; } if(ExecThread.IsAlive) { ExecThread.Abort(); ExecThread.Join(); string LogMsg=""; LogMsg="Thread Aborted "; if(Subject!=null) { LogMsg=LogMsg+"Subject :"; LogMsg=LogMsg+Subject; } LogClass.WriteToLog(InfoLevel1,LogMsg); }
  11. Hi, again How can i get the round trip time value using WinSocket 2? THX a lot
  12. Hermes

    TBD, what

    Hi ya folks! Does anybody in the neighbourhood know what is this TBD protocol? Thanks a lot
  13. Hi, I have a COM+ application that eats CPU alive after a few hours with no evident reason since we couldn't reproduce it on the same hardware platform that our clients use.(dual Xeon with HT) So we have to reset it when the dllhost COM+ surrogate exeeds the acceptable CPU usage(eg.50%). I tried querrying the cpu usage of our process ID using performance counters, but i soon found out that on a a Intel P4 with HT my results are doubled (eg. Instead of 50% as the TaskManager shows i have 100% ).Instead, on a processor without HT everything is OK. My question is....on a dual Xeon with HT what would my results look like ...are they four times the real value? Here's my implementation: int CCpuUsage::GetCpuUsage(DWORD dwProcessID) { static PLATFORM Platform = GetPlatform(); if (m_bFirstTime) EnablePerformaceCounters(); // Cpu usage counter is 8 byte length. CPerfCounters<LONGLONG> PerfCounters; DWORD dwObjectIndex = PROCESS_OBJECT_INDEX; DWORD dwCpuUsageIndex = PROCESSOR_TIME_COUNTER_INDEX; int CpuUsage = 0; LONGLONG lnNewValue = 0; PPERF_DATA_BLOCK pPerfData = NULL; LARGE_INTEGER NewPerfTime100nSec = {0}; lnNewValue = PerfCounters.GetCounterValueForProcessID(&pPerfData, dwObjectIndex, dwCpuUsageIndex, dwProcessID); //trying a fix //lnNewValue/=2.0; NewPerfTime100nSec = pPerfData->PerfTime100nSec; if (m_bFirstTime) { m_bFirstTime = false; m_lnOldValue = lnNewValue; m_OldPerfTime100nSec = NewPerfTime100nSec; return 0; } LONGLONG lnValueDelta = lnNewValue - m_lnOldValue; double DeltaPerfTime100nSec = (double)NewPerfTime100nSec.QuadPart - (double)m_OldPerfTime100nSec.QuadPart; m_lnOldValue = lnNewValue; m_OldPerfTime100nSec = NewPerfTime100nSec; double a = (double)lnValueDelta / DeltaPerfTime100nSec; CpuUsage = (int) (a*100); if (CpuUsage < 0) return 0; return CpuUsage; } T GetCounterValueForProcessID(PERF_DATA_BLOCK **pPerfData, DWORD dwObjectIndex, DWORD dwCounterIndex, DWORD dwProcessID) { QueryPerformanceData(pPerfData, dwObjectIndex, dwCounterIndex); PPERF_OBJECT_TYPE pPerfObj = NULL; T lnValue = {0}; // Get the first object type. pPerfObj = FirstObject( *pPerfData ); // Look for the given object index for( DWORD i=0; i < (*pPerfData)->NumObjectTypes; i++ ) { if (pPerfObj->ObjectNameTitleIndex == dwObjectIndex) { lnValue = GetCounterValueForProcessID(pPerfObj, dwCounterIndex, dwProcessID); break; } pPerfObj = NextObject( pPerfObj ); } return lnValue; } T GetCounterValueForProcessID(PPERF_OBJECT_TYPE pPerfObj, DWORD dwCounterIndex, DWORD dwProcessID) { int PROC_ID_COUNTER = 784; BOOL bProcessIDExist = FALSE; PPERF_COUNTER_DEFINITION pPerfCntr = NULL; PPERF_COUNTER_DEFINITION pTheRequestedPerfCntr = NULL; PPERF_COUNTER_DEFINITION pProcIDPerfCntr = NULL; PPERF_INSTANCE_DEFINITION pPerfInst = NULL; PPERF_COUNTER_BLOCK pCounterBlock = NULL; // Get the first counter. pPerfCntr = FirstCounter( pPerfObj ); for( DWORD j=0; j < pPerfObj->NumCounters; j++ ) { if (pPerfCntr->CounterNameTitleIndex == PROC_ID_COUNTER) { pProcIDPerfCntr = pPerfCntr; if (pTheRequestedPerfCntr) break; } if (pPerfCntr->CounterNameTitleIndex == dwCounterIndex) { pTheRequestedPerfCntr = pPerfCntr; if (pProcIDPerfCntr) break; } // Get the next counter. pPerfCntr = NextCounter( pPerfCntr ); } if( pPerfObj->NumInstances == PERF_NO_INSTANCES ) { pCounterBlock = (PPERF_COUNTER_BLOCK) ((LPBYTE) pPerfObj + pPerfObj->DefinitionLength); } else { pPerfInst = FirstInstance( pPerfObj ); for( int k=0; k < pPerfObj->NumInstances; k++ ) { pCounterBlock = (PPERF_COUNTER_BLOCK) ((LPBYTE) pPerfInst + pPerfInst->ByteLength); if (pCounterBlock) { int processID = 0; processID = *(T*)((LPBYTE) pCounterBlock + pProcIDPerfCntr->CounterOffset); if (processID == dwProcessID) { bProcessIDExist = TRUE; printf("\n Found process in PerfCounters"); break; } } // Get the next instance. pPerfInst = NextInstance( pPerfInst ); } } if (bProcessIDExist && pCounterBlock) { T *lnValue = NULL; lnValue = (T*)((LPBYTE) pCounterBlock + pTheRequestedPerfCntr->CounterOffset); return *lnValue; } return -1; }
  14. Hi, I need to import a function from a Win32 dll written in C++ to a C# Windows Service. Here's the DLL implementation: __declspec(dllexport) int __stdcall GetCPU(LPSTR szProcess) { CCpuUsage cpu=CCpuUsage();//a class into the dll return cpu.GetCpuUsage(szProcess); } and this is the import in C# [DllImport("CPU_Usage.dll")] public extern static int GetCPU(string processName); The error i get is: 'Unable to find an entry point named GetCPU in dll Cpu_Usage.dll' Thx a million !
  15. Hi! Does anybody know how to debug a COM+ application (C#.NET2003)? THX
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!