|
Even if he had kernel access he couldn't!
The kernel does not use handles for the process. It uses pointers to EPROCESS structures!
Don't try it, just do it!
|
|
|
|
|
I know that I can make a driver and use deviceiocontrol and get the handle out but just tell me the function.
The EPROCESS structure doesn't have a member for the handle.
I know about this function
NTSYSAPI
NTSTATUS
NTAPI
PsLookupProcessByProcessId (
IN ULONG ProcessId,
OUT PEPROCESS *Process
);
and this is all I know about eprocess
typedef struct _EPROCESS {
KPROCESS Pcb;
EX_PUSH_LOCK ProcessLock;
...
UCHAR ImageFileName[16];
...
UCHAR PriorityClass;
BOOLEAN WorkingSetAcquiredUnsafe;
} EPROCESS, *PEPROCESS;
is KPROCESS the process HANDLE and if it is what ACCESS does it have, i supose PROCESS_ALL_ACCESS right ??/
gabby
|
|
|
|
|
i wonder how can I get an IMAGE_FUNCTION_ENTRY of a certain function in a dll
is it
IMAGE_FUNCTION_ENTRY *IFE=(IMAGE_FUNCTION_ENTRY *)((BYTE *)hMod+FunctionAddress) ????
this returns a non NULL value but I am not sure if it is a valid structure
gabby
|
|
|
|
|
|
It is definitly not.
The code you are using may not even create a pointer to valid memory.
Read the "SymFunctionTableAccess64" page in MSDN and you will see that IMAGE_FUNCTION_ENTRY is not used on x86 (Intel + AMD) platforms.
Don't try it, just do it!
|
|
|
|
|
I'm trying to teach myself C++. I making a real simple calculator (console app) from an exercise in a book. It needs to display, "Press any key to continue".
I declared a variable chKey, but when I hit enter the cursor just keeps moving down the command prompt.
cout << "PRESS ANY KEY TO CONTINUE\n\n";
cin >> chKey;
Is there anything I need to do to "continue"? The book is no help.
Thanks
|
|
|
|
|
Try this instead:
cout << "PRESS ANY KEY TO CONTINUE" << endl << endl;
getch();
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
How do you clear the console screen?
THanks
|
|
|
|
|
See MSDN article Q99261.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
|
system("cls");
or use
-------
void clrscr(TCHAR FillChar)
{
COORD coordScreen = { 0, 0 };
DWORD cCharsWritten;
CONSOLE_SCREEN_BUFFER_INFO csbi;
DWORD dwConSize;
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
GetConsoleScreenBufferInfo(hConsole, &csbi);
dwConSize = csbi.dwSize.X * csbi.dwSize.Y;
FillConsoleOutputCharacter(hConsole, FillChar, dwConSize, coordScreen, &cCharsWritten);
GetConsoleScreenBufferInfo(hConsole, &csbi);
FillConsoleOutputAttribute(hConsole, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten);
SetConsoleCursorPosition(hConsole, coordScreen);
return;
}
-------
and maybe you will need gotoxy too ( X-D )
-------
void gotoxy(int x, int y)
{
COORD pos;
pos.X = x-1; pos.Y = y-1;
SetConsoleCursorPosition(GetStdHandle( STD_OUTPUT_HANDLE ), pos);
}
|
|
|
|
|
That only seems to clear the screen if I hit enter. Any key would work. Please help.
|
|
|
|
|
I often use the function Shellexecute to run for example gzip.exe to compress files. How can I stop the execution of my program to wait for the “gzip-process” to return?
May I use any other function to accomplish my task?
_____________________________
...and justice for all
APe
|
|
|
|
|
Use WaitForSingleObject() .
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
DWORD ExitCode;
STARTUPINFO si;
ZeroMemory(&si,sizeof(STARTUPINFO));
si.cb = sizeof(STARTUPINFO);
PROCESS_INFORMATION pi;
if(!CreateProcessA(0, "notepad.exe", NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS, NULL, 0, &si, &pi))
{
printf("CreateProcess false\n");
return -1;
}
WaitForSingleObject(pi.hProcess, INFINITE);
GetExitCodeProcess(pi.hProcess, &ExitCode);
CloseHandle(pi.hThread);
CloseHandle(pi.hProcess);
if (ExitCode == 0)
{
// ...
}
....
|
|
|
|
|
Anyone know of a program / class / piece of code that will take an irregularly spaced set of (x,y,z) data and transform to regularly spaced contours?
cheers,
Chris Maunder
|
|
|
|
|
Sound like the problem faced in Boundary Element Method.
...
|
|
|
|
|
GTS - GNU Triangulated Surface Library:
http://gts.sourceforge.net/index.html[^]
which won't create the contours, but will generate the delaunay triangulation.
From there you could write a routine to find all triangles spanning a given elevation, interpolate along their edges to get x,y coord and generate the contours.
GMT should be able to do what you want:
http://gmt.soest.hawaii.edu/[^]
... although it is a bit of overkill.
It's a bit of pain to get through the website, as a short-cut:
- goto ftp://falcon.grdl.noaa.gov/pub/gmt/4/[^]
- download GMT_progs.zip
- to start with look at xyz2grd.c and grdcontour.c
...cmk
Save the whales - collect the whole set
|
|
|
|
|
here is my code:
---------------------------------------------
RECT rect;
GetWindowRect(hWnd, & rect);
HDC hDC = GetDC(hWnd);
HDC hDCMem = CreateCompatibleDC(hDC);
HBITMAP hBmp = NULL;
hBmp = CreateCompatibleBitmap(hDC, rect.right - rect.left, rect.bottom - rect.top);
HGDIOBJ hOld = SelectObject(hDCMem, hBmp);
SendMessage(hWnd, WM_PRINT, (WPARAM) hDCMem, PRF_CHILDREN | PRF_CLIENT | PRF_ERASEBKGND | PRF_NONCLIENT | PRF_OWNED);
SelectObject(hDCMem, hOld);
OpenClipboard(NULL);
EmptyClipboard();
SetClipboardData(CF_BITMAP, hBmp);
CloseClipboard();
DeleteDC(hDCMem);
ReleaseDC(hWnd,hDC);
---------------------------------------------
if hWnd holds the handle of the window of the same program in which i place this code then it works fine. but if i store another program's window's handle in it then it gives me black image. the size of the image is according to the window whose handle was given but the image is totally black. i get the handle of other windows through the FindWindow fucntion.
can anybody tell me where did i go wrong?
|
|
|
|
|
im not sure i think window must be visible on screen ... try test with HWND hWnd = GetForegroundWindow();
|
|
|
|
|
use:
-------------------------------
HDC hdc;
RECT rect;
HWND hWnd = GetForegroundWindow();
hdc = GetWindowDC(hWnd);
GetClientRect(hWnd, &rect);
HDC hDest = CreateCompatibleDC(hdc);
HBITMAP hbDesktop = CreateCompatibleBitmap(hdc, rect.right - rect.left, rect.bottom - rect.top);
SelectObject(hDest, hbDesktop);
BitBlt(hDest, 0,0, rect.right - rect.left, rect.bottom - rect.top, hdc, 0, 0, SRCCOPY);
OpenClipboard(NULL);
EmptyClipboard();
SetClipboardData(CF_BITMAP, hbDesktop);
CloseClipboard();
DeleteDC(hDest);
ReleaseDC(hWnd,hdc);
-------------------------------
|
|
|
|
|
BitBlt requires that your window is not minmized and not even covered. I don't want this. I want to do it with SendMessage. Even if I first get the window to foreground and then capture its image, i get a black one. (if the handle was of another program's window)
|
|
|
|
|
Hello,
I want to know how I can convert ASCII strings into their Hex Values. For example:
A = 41
K = 4B
I'm programming with Dev-C++ if this is any help.
With best regards,
Benedikt
|
|
|
|
|
use:
char* mystring = "Hello world!";
for (int x = 0; x < strlen(mystring); x++)
{
printf("%x ", mystring[x]);
}
|
|
|
|
|
Thank you !
And how can I convert hex back to ascii ?
With best regards,
RedDragon2kx
|
|
|
|