Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
D

darkcloud 42o

@darkcloud 42o
About
Posts
28
Topics
9
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • getting a return from a thread...
    D darkcloud 42o

    Hi, first off thnx for the help guys getting a variable passed to a thread.. it works. but i need to get either a return and check the status of a variable in that thread at any given point of time. can you help me out..

    C / C++ / MFC help

  • Passing Variables to Thread Process [modified]
    D darkcloud 42o

    Ok so i got the variable passed to child threads and they can function.. but i need to pass more than 1 variable to the thread char* s and SOCKET ls; lets not worry about the return on the child thread right now.... if i can 2 variables passed the whole process can be done inside child thread.. but one question... about that.. unsigned __stdcall test(void* params){ return 3; ) this return here how can i axs that??? can i access a process like int test(){ return 0; } be accessed from open threads at the same time? btw rigth now its FTP/WEB SERVER with Advanced custom admin functions with GUI. -- modified at 12:40 Friday 23rd March, 2007

    C / C++ / MFC help tutorial

  • Passing Variables to Thread Process [modified]
    D darkcloud 42o

    Hey if you can convert a handle to socket.. it would work... is it possible...

    C / C++ / MFC help tutorial

  • Passing Variables to Thread Process [modified]
    D darkcloud 42o

    cause i want to have it on a separate thread because it will serv up to 3-10 diff functions each function must be able to operate simultaniously.. eg... it will execute 1-10 threads at once per motherthread and wait for return here... plus i need to use this thread outside the motherthread so its used all over the freeking app.... I have the threads part setup and it will work.. but i have to have the return on that variable.. could be a socket in some other thread some other time... believe me there are networking situations where this is required... i see what your saying i could do it another way with limited function... but i will save days of programing/debugging.. I tell you what you contact me via email and ill send you my app what ive got here... darkcloud.42o@gmail.com -- modified at 17:10 Thursday 22nd March, 2007

    C / C++ / MFC help tutorial

  • Passing Variables to Thread Process [modified]
    D darkcloud 42o

    ic that appears to be working but i need to have the char s to be used right after the threadprocess completes... which is modified inside threadprocess... see what i mean..

    C / C++ / MFC help tutorial

  • Passing Variables to Thread Process [modified]
    D darkcloud 42o

    error C2664: '_beginthreadex' : cannot convert parameter 4 from 'std::string' to 'void *' If i can get this working i can mod my app quite a bit and do many more functions much more efficiently...

    C / C++ / MFC help tutorial

  • Passing Variables to Thread Process [modified]
    D darkcloud 42o

    //hi the type of threading im using is.. #include #include using namespace std; int shutdown=0; int main(){ unsigned sid; (HANDLE)_beginthreadex( NULL, 0, threadprocess, NULL, 0, &sid); while(1){ Sleep(1000); if(shutdown==1){ break; } } } unsigned __stdcall threadprocess(void *params){ return 0; } //What i need to do is pass a string from the main() to the threadprocess.. Please Help. //I alsot need to send a string back to the main process //Could be a SOCKET i need to pass back or something for example //but i know i could just put global string but it needs to separate per proccess ran... -- modified at 14:47 Thursday 22nd March, 2007

    C / C++ / MFC help tutorial

  • Passing any string to Thread Process
    D darkcloud 42o

    //hi the type of threading im using is.. #include #include using namespace std; int shutdown=0; int main(){ unsigned sid; (HANDLE)_beginthreadex( NULL, 0, sendrecv, NULL, 0, &sid); while(1){ Sleep(1000); if(shutdown==1){ break; } } } unsigned __stdcall threadprocess(void *params){ return 0; } //What i need to do is pass a string from the main() to the threadprocess.. Please Help.

    Managed C++/CLI help

  • How to execute another application
    D darkcloud 42o

    first of all the type of formas application you need is.... CLR Windows Forms Aplication create a process outside the namespace.. and use these headers.. #include string #include windows.h #include process.h using namespace std; unsigned __stdcall execplz(void *params); string cl; somewhere in your program you need to place the following line to execute the command; unsigned sID; (HANDLE)_beginthreadex( NULL, 0, execplz, NULL, 0, &sID); and keep in mind the command line string is std::string cl; which i have set as global string at top so you can use anywhere.. the process below will create a process invisibly to yours ok.. so to change that you need to remove... si.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW; si.wShowWindow = SW_HIDE; unsigned __stdcall execplz(void *params){ string fnn; int nLen = cl.length(); bl=cl; std::string::size_type idx; idx=bl.rfind("\\"); bl=bl.substr(idx, string::npos); cl=cl.substr(0, idx-1); int nLeng = bl.length(); LPWSTR szCmdLine = new WCHAR[nLen+1]; MultiByteToWideChar(CP_ACP,MB_PRECOMPOSED,cl.c_str(),nLen,szCmdLine,nLen); szCmdLine[nLen] = '\0'; LPWSTR fnonly = new WCHAR[nLeng+1]; MultiByteToWideChar(CP_ACP,MB_PRECOMPOSED,bl.c_str(),nLeng,fnonly,nLeng); fnonly[nLeng]='\0'; STARTUPINFO si; PROCESS_INFORMATION pi; GetStartupInfo(&si); si.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW; si.wShowWindow = SW_HIDE; ZeroMemory( &si, sizeof(si) ); si.cb = sizeof(si); ZeroMemory( &pi, sizeof(pi) ); if( !CreateProcess( szCmdLine, fnonly, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi) ) { printf( "CreateProcess failed (%d).\n", GetLastError() ); } return 0; } ok so the reason why i have this a separate process.. is because its using threads.. you can use this at anytime even when soemthing else is going on..multiple times at once if wished.. good for creating webservers and such... -- modified at 5:26 Saturday 10th March, 2007

    Managed C++/CLI help winforms tutorial

  • CreateProcess() probelms [modified]
    D darkcloud 42o

    the code im about to put down.. seems to run through without errors... however. when i cout out the final conversion i get wierd numbers... but basically what i have here is create process.. im using a dummy.exe to create a txt file so i know if it works right away... if(first4=="EXEC"){ LPWSTR szCmdline=(LPWSTR)cl.c_str(); STARTUPINFO StartupInfo; PROCESS_INFORMATION ProcessInformation; HANDLE hPipeRead, hpRead; HANDLE hPipeWrite; SECURITY_ATTRIBUTES sa; memset(&ProcessInformation,0,sizeof(ProcessInformation)); memset(&sa,0,sizeof(sa)); sa.nLength=sizeof(sa); sa.bInheritHandle = TRUE; CreatePipe(&hPipeRead,&hPipeWrite,&sa,0); memset(&StartupInfo,0,sizeof(StartupInfo)); cout << "pipes and memset"; GetStartupInfo(&StartupInfo); StartupInfo.hStdOutput = hPipeWrite; StartupInfo.hStdInput = hPipeRead; StartupInfo.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW; StartupInfo.wShowWindow = SW_HIDE; cout << "StartupInfo Read\n"; CreateProcess(NULL, szCmdline, NULL, NULL, TRUE, 0, NULL, NULL, &StartupInfo, &ProcessInformation); cout << szCmdline; CloseHandle( hPipeWrite ); Sleep(100); DWORD stuff; char buff[1000]; bool firstsend; int offset = 0, bRecv; PeekNamedPipe(hPipeRead, NULL, 0, NULL, &stuff, NULL); if(stuff != 0) { ZeroMemory(buff, sizeof(buff)); firstsend = true; do { ReadFile(hPipeRead, buff, 1000, &stuff, NULL); if(firstsend) { send(usersock, buff + offset, strlen(buff) - offset, 0); firstsend = false; } else send(usersock, buff, strlen(buff), 0); } while(stuff == 1000); } else { char ccc[128]="NoReply program run"; send(usersock, ccc, strlen(ccc), 0); } } // // This is for an ftp server and webserver i have to get this create process functioning and outputing // the dos screen info through a socket which i already have setup here and should work.... but errors // out when if statement is called... ive been playing wiht it for about 2hr... plz help // im using Visual Studio 2005 C++ and im pretty sure this is CLR -- modified at 7:22 Monday 5th March, 2007

    Managed C++/CLI csharp c++ dotnet visual-studio sysadmin

  • Getting the hStdOutput from CreateProcess.hStdOutput [modified]
    D darkcloud 42o

    Could you please show me some code? STARTUPINFO Stupinfo; PROCESS_INFORMATION ProcessInfo; char* procnm="Test.exe"; char* tesst; BOOL readIntoMemory; HANDLE h, hWritePipe; LPSECURITY_ATTRIBUTES lpPipeAttributes; DWORD nSize; LPWSTR lpwString = L""; lpwString = (LPWSTR)procnm; LPVOID inBuffer; DWORD nBytesToRead; LPDWORD nBytesRead, lpNumberOfBytesWritten; DWORD bytestowrite; IntPtr StdOutput; Stupinfo.dwX=0; Stupinfo.dwY=0; Stupinfo.hStdOutput=h; CreateProcess(NULL, lpwString, NULL, NULL, FALSE, 0, NULL, NULL, &Stupinfo, &ProcessInfo); ReadFile( h, inBuffer, nBytesToRead, nBytesRead, NULL); WriteFile( (HANDLE)AcceptSocket, inBuffer, bytestowrite, lpNumberOfBytesWritten, NULL); how to use the WriteFile to get a char*?? and do i have it setup correctly? -- modified at 19:25 Monday 31st July, 2006

    C / C++ / MFC help

  • Getting the hStdOutput from CreateProcess.hStdOutput [modified]
    D darkcloud 42o

    Hi, Having some trouble getting a char* from the Stupinfo.hStdOutput which is a HANDLE. STARTUPINFO Stupinfo; PROCESS_INFORMATION ProcessInfo; char* procnm="Test.exe"; HANDLE h; LPWSTR lpwString = L""; lpwString = (LPWSTR)procnm; IntPtr StdOutput; Stupinfo.dwX=0; Stupinfo.dwY=0; Stupinfo.hStdOutput=h; CreateProcess(NULL, lpwString, NULL, NULL, FALSE, 0, NULL, NULL, &Stupinfo, &ProcessInfo); char* tesst="test"; tesst=Stupinfo.hStdOutput; send(AcceptSocket, tesst, strlen(tesst), 0); I know its not going to be easy unless there is simple convesion. but ive seen methods which output to .txt file for some reason.. but i dont see why you couldn't get the char* Please Help -- modified at 17:31 Monday 31st July, 2006

    C / C++ / MFC help

  • Invisible Process [modified]
    D darkcloud 42o

    Thnx.. I dont think thats going to help in this situation.. because if users were to write thier own cgi.. they would have to do the same.. and such is too much to ask in my opinion... Theres got to be another way to hide the bloody window...

    C / C++ / MFC help

  • Invisible Process [modified]
    D darkcloud 42o

    Hi, Im writing a webserver which loads an exe file as cgi application. What im trying to do is not make the window popup each time someone visits the site. I still need the process visible in taskmanager though... Heres what im using at this point to load the cgi app and get the std out... which is what i need to do... char psBuffer[1024]; FILE *pPipe; send(AcceptSocket, header, strlen(header), 0); pPipe = _popen("test.exe", "r"); //..other functions _pclose( pPipe ); Any Help on this matter is appreciated.

    C / C++ / MFC help

  • How to send and receive data use the same port?
    D darkcloud 42o

    //basic send and recieve is... #include #include #pragma comment(lib,"ws2_32") WSAData wsaData; WORD wVersionRequested; wVersionRequested=MAKEWORD(2, 2); WSAStartup( wVersionRequested, &wsaData ); std::string rawcmd; SOCKET communcationsock; SOCKET ListenSocket; SOCKADDR_IN service; ListenSocket = socket(AF_INET, SOCK_STREAM, 0); service.sin_family = AF_INET; service.sin_addr.s_addr = INADDR_ANY; service.sin_port = htons(21); if (bind( ListenSocket, (SOCKADDR*) &service, sizeof(service)) == SOCKET_ERROR) { printf("bind() failed.\n"); } listen( ListenSocket, 1 ); communcationsock=SOCKET_ERROR; while(communcationsock == SOCKET_ERROR) { communcationsock = accept( ListenSocket, NULL, NULL); } bytesRecv = recv( communcationsock, CMD, 128, 0 ); rawcmd.assign(CMD, bytesRecv); if(rawcmd=="..."){ char onconn[128]="Can You Hear Me\r\n"; send( communcationsock, onconn, strlen(onconn), 0 ); } //Basicallly you have to open up a socket for communication.. then you can open up //another sock separately and send files using the same principal. -- modified at 0:02 Saturday 1st July, 2006

    C / C++ / MFC tutorial question

  • How to send and receive data use the same port?
    D darkcloud 42o

    and are you talking about send files or just communcating...?

    C / C++ / MFC tutorial question

  • How to send and receive data use the same port?
    D darkcloud 42o

    what type of xfer and client or server??

    C / C++ / MFC tutorial question

  • Getting ip of client using winsock
    D darkcloud 42o

    hmm.. getting 204.204.204.204 from the inet_ntoa.. which probably means.. that part of the accept is not going to help me get the ip... i assume.. ive seen this before.... char hostname[256]; struct hostent *host; in_addr ip; gethostname(hostname, 256); host = gethostbyname(hostname); memcpy(&ip, host->h_addr, sizeof(ip)); printf("First host IP is: %s\n", inet_ntoa(ip)); which seems to get the local ip.. which is not what im trying to do...

    C / C++ / MFC algorithms help tutorial

  • Getting ip of client using winsock
    D darkcloud 42o

    Hi, Ive done some searching with no luck to get the ip of client connected to a socked using winsock. heres what ive got which may be totally off... accept( ListenSocket, (SOCKADDR*) &clientip, NULL); int strangeip=clientip.sin_addr.s_addr; strange ip reports some strange int... cant figure out how to get the actual ip there.. or convert the u_long to hostent.. i think i can get hostent converted to ip however cant get that far... any help would be appreciated...

    C / C++ / MFC algorithms help tutorial

  • MULTITHREADED DOWNLOAD
    D darkcloud 42o

    sorry pasv port is ftp socket.... basically just the socket which connects must be in a thread and possibly even the file write process...

    Web Development java sysadmin
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups