|
I'm trying to get the command line parameters of a running process. Does anyone know how to do this? I know I can set a windows hook with WH_SHELL, but I would like to be able to do it on the fly instead of having my application started before the processes I'm trying to view.
-- Rocky Dean Pulley
|
|
|
|
|
You could use the GetCommandLine API.
Put this API in a function and run the function remotely using CreateRemoteThread.
« Superman »
|
|
|
|
|
Thanks, that's what I'm about to try. I was hoping there was a way to do it without injecting anything but this will do I think.
Thanks,
-- Rocky
-- Rocky Dean Pulley
|
|
|
|
|
The fourth parameter to CreateRemoteThread() is the starting point of the new thread. How do you go about getting that starting point (i.e., function) into the other process?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
rocky_pulley wrote:
I'm trying to get the command line parameters of a running process.
See here.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hello,
I am facing with a problem while trying to allocate very large memory by AWE APIs on Windows 2003 Advanced Server. I developed following code in order to allocate large memory portion, but I couldn't allocate it;
#include "stdafx.h"
#define _WIN32_WINNT 0x0500
#include <windows.h>
#include <stdio.h>
#define MEM_ALLOC 1024 * 1024 * 1024 * 4 // allocate physical memory
int _tmain(int argc, _TCHAR* argv[])
{
struct {
DWORD count;
LUID_AND_ATTRIBUTES privilege[1];
} info;
HANDLE token=0x0;
BOOL result=FALSE;
int iPageCount=0x0;
int PFNarraysize=0x0;
ULONG_PTR NumberOfPages=0x0;
ULONG_PTR* PFNarraylist=0x0;
SYSTEM_INFO sys_info;
PVOID lpMemoryWindow=0x0;
// get system page size
GetSystemInfo(&sys_info);
// calculate how many pages required
iPageCount = MEM_ALLOC / sys_info.dwPageSize;
// PFN requested size
PFNarraysize = iPageCount * sizeof(ULONG_PTR);
// allocate array for PFN array
PFNarraylist = (ULONG_PTR*)HeapAlloc(GetProcessHeap(), 0, PFNarraysize);
// ------------------------------------------------------------- //
// check user privileges in order to lock memory on the system
result = OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &token);
// set privilege attributes
info.privilege[0].Attributes = SE_PRIVILEGE_ENABLED;
// lookup user privileges
result = LookupPrivilegeValue(NULL, SE_LOCK_MEMORY_NAME, &(info.privilege[0].Luid));
// info count
info.count=0x1;
// retrieve user privilege
result = AdjustTokenPrivileges(token, FALSE, (PTOKEN_PRIVILEGES)&info, 0, NULL, NULL);
// close token handle
CloseHandle(token);
// ------------------------------------------------------------- //
// create memory window
lpMemoryWindow=VirtualAlloc(NULL, MEM_ALLOC, MEM_RESERVE | MEM_PHYSICAL, PAGE_READWRITE);
NumberOfPages = iPageCount;
// allocate physical memory - I
result = AllocateUserPhysicalPages(GetCurrentProcess(), &NumberOfPages, PFNarraylist);
// map user physical page to the window - I
result = MapUserPhysicalPages(lpMemoryWindow, iPageCount, PFNarraylist);
// use memory
lstrcpy((LPSTR)lpMemoryWindow, TEXT("OGED"));
}
In the example that I wrote above can allocate 2 gb or less memory but not more and I am sure that I have 16 Gb physical memory.
How can I allocate and use more than 4 Gb memory? Can anybody give an example about AWE?
PS: I am aware about MSDN AWE and MSDJ - 99 examples, but they are not a solution for my case.
Regards,
Orkun GEDiK
SAP R/3 Software & System Support Specialist
ASTRON
|
|
|
|
|
You do not say it or not, but are you booting with the /PAE switch? You need it to enable applications to address at and above 4GB. Normally, you can only address 2GB unless you booted with the /3GB switch.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
Hello,
Sorry, I forgot to say that, "I am using /PAE switch already".
Regards,
Orkun GEDiK
SAP R/3 Software & System Support Specialist
ASTRON
|
|
|
|
|
Codeguru,
I have a property sheet, which contains a nmber of property pages. One of the pages contains a CTreeCtrl.
The tree control is used to display a list of items with tick boxes. The list of items never changes, however the ticks next to then respond to changes in the document structure.
I use OnInitDialog to create the list of elements using InsertItem and also log the handles for later use.
I then use OnSetActive to record each time the user clicks the page and update the tick boxes using SetCheck and the recorded handles from OnInitDialog.
My problem:...
The property page has to be shown twice, first the items appear and second the tick boxes are correct. Thereafter everything works fine.
I'm presuming this is because the inserted items have not been activated until after the page is made visible? Therefore SetCheck doesn't do anything on the first pass. But I've tried to resolve this with a call the the property sheet to call another page, using SetActivePage(*), then reactivating the current one. However, this doesn't work. Also tried various update calls inbetween OnInitDialog and OnSetActive, but to no avail.
Any ideas what I'm doing wrong? The help would be very much appreciated
James
|
|
|
|
|
I remembered dealing with a quirky problem involving CTreeCtrl checkboxes. I checked some code in an old project, and found this:
<br />
<br />
m_treeCtrl.ModifyStyle(TVS_CHECKBOXES, 0);<br />
m_treeCtrl.ModifyStyle(0, TVS_CHECKBOXES);<br />
The fix came via the one of the newsgroups. I don't know if it will help your problem, but it's worth a shot.
Pssst. You see that little light on your monitor? That's actually a government installed spy camera. Smile and wave to big brother!
|
|
|
|
|
Thankyou, thankyou, thankyou!!!!
As I expected, a random bug with a very random solution.
But it works
|
|
|
|
|
Please tell me that why does the first two bytes of a Bitmap image is being shown as '19778' which is equal to '4D42H' in VC environent.
whereas in theory it is to be 'BM' which is '424DH' in the bitmap image.
MoQuisha
|
|
|
|
|
Ascii Code of 'B' = 0x42
Ascii Code of 'M' = 0x4D
'BM' is the signature of the bitmap file, it helps the image viewers to identify that this file is a bitmap file. If you rename a text file and make its extension .bmp than it does not mean that it is a windows bitmap file.
http://www.priyank.in/
|
|
|
|
|
Hello,
It has something to do with the way data is stored in the memory of the computer. This problem is also known as the NUXI problem.
Read this[^] for more information about the problem.
I also got the blogging virus..[^]
|
|
|
|
|
|
Hello,
I have the following code:
<br />
#define A_THING(ARG) \<br />
# define ANOTHER_THING const ARG \<br />
When I compile the code, I get the following error: "error C2162: expected macro formal parameter"
The following code does not produce errors:
<br />
#define A_THING() \<br />
# define ANOTHER_THING const ARG<br />
The most weird part is, that I don't even use the first macro in the code. If I use it, I get the same errors...
I also got the blogging virus..[^]
|
|
|
|
|
|
|
Bob Stanneveld wrote:
I have the following code:
#define A_THING(ARG)
Then Where is the Problem Bob!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
|
I have found the source of my problem. This is that the '#' symbol is used inside macros to make a string of an argument. For example:
<br />
#define TO_STRING(arg) #arg<br />
<br />
TO_STRING(This is a string)
So the compiler looks for an argument named 'define', but cannot find it, thus issuing an error. Is there any way that I can work around this problem?
Thanks in advance
I also got the blogging virus..[^]
|
|
|
|
|
Don't do the line continuations. To the preprocessor, it sees:
#define A_THING(ARG) # define ANOTHER_THING const ARG \....
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
I'm working on a program that I'd like to be open to customization by the user. It will generate messages (to be sent over Ethernet or serial ports) and allow the user to specify a set of rules to follow when doing so. I'd like the user to be able to create a list of steps to take and also allow the user to create loops and test conditions (if, else, ...).
For now, I'm hardcoding task types but it would be nice if I could allow the user to write a script that my software could understand and follow instead of forcing the user to use my pre-built task types.
I know it's not going to be easy or quick but I'd still like to look into it further. Does anyone know where I might find information on doing something like this? Would it be possible to use an existing scripting language (PERL or other)?
Thanks for any info you might have on this.
|
|
|
|
|
The older "Visual BASIC for Applications" possibly
Or try this msdn.microsoft.com/scripting
|
|
|
|
|
I want to take the color of any pixel on the screen.
I want to simulate mouse click at any position at the screen.
I don't have idea how to do this . and I'll appreciate any idea.
Thanks in advance.
|
|
|
|