|
To check the number of argument passed.
for example
if (argc != 3)
{
printf("usage: myapp <srcfile> <dstfile>");
// Here 0 = myapp
// 1 = srcfile
// 2 = dstfile
//Total 3 Arguments entered
return FALSE;
}
pszSrcFileName = argv[argc-2]; // Src is second to last argument
pszDstFileName = argv[argc-1]; // Dst is the last argument
by default no arguments are passed. Unless you have created a program that read a Command Line Arguments.
Regards,
Vishal
|
|
|
|
|
Abder_Rahman wrote: what are those arguments I'm passing to the constructor and at the same time cannot explicitly see?
If you can put a break point in the constructor, you should be able to see the arguments passed to QApplication from the program entry point (main or WinMain )
The arguments are passed to the entry point via the command line, or form the application properties (right-click on the EXE).
The QApplication allows some default parameters. (see http://doc.qt.nokia.com/4.7/qapplication.html#QApplication[^] ).
I assume a QT developer can also add his own command line parameters by overriding either the QApplication and maybe a couple of methods to handle and parse the new parameters.
Other than that, I'm not certain what is the question.
Max.
Watched code never compiles.
|
|
|
|
|
Like grid control is it possible to add a fixed row in list control (clistctrl)
If i create a list control with LVS_EX_CHECKBOXES style then check box display in 1st column. Can i change check box position to any other column in list control
|
|
|
|
|
|
You can change the check box position by using this APIListView_SetColumnOrder ->[^]
"Every Little Smile can touch Somebody's Heart...
May we find Hundreds of Reasons to Smile Everyday... and
May WE be the Reason for someone else to smile always!" (ICAN)
|
|
|
|
|
hi to all,
I am writing a function to check access rights on file or folder using AclAPI.h
I am using following api's
GetFileSecurity()
ImperonateSelf()
OpenThreadToken()
MapGenericMask()
AccessCheck()
do i have to include
#pragma comment(lib, "advapi32.lib")
in my code or not.
Without including #pragma comment(lib, "advapi32.lib") Program is working.
and
BOOL WINAPI OpenThreadToken(
__in HANDLE ThreadHandle,
__in DWORD DesiredAccess,
__in BOOL OpenAsSelf,
__out PHANDLE TokenHandle
);
what does parameter in OpenThreadToken (OpenAsSelf) means.
Please give some valuable suggestions.
Regards,
Vishal
|
|
|
|
|
Answer to first question: If the program is working without it, you have your answer.
Answer to second question: From MSDN:
OpenAsSelf [in] -
TRUE if the access check is to be made against the process-level security context.
FALSE if the access check is to be made against the current security context of the thread calling the OpenThreadToken function.
The OpenAsSelf parameter allows the caller of this function to open the access token of a specified thread when the caller is impersonating a token at SecurityIdentification level. Without this parameter, the calling thread cannot open the access token on the specified thread because it is impossible to open executive-level objects by using the SecurityIdentification impersonation level.
|
|
|
|
|
advapi32.lib is already linked in the linker. Found in the Project Settings ->Linker->Input->Additional Dependencies.
thanks. for your reply.
Regards,
Vishal
|
|
|
|
|
Hello, I need a source code simple windows explorer or file manager on c++ using functions winapi,thank you very much
|
|
|
|
|
Try Google[^].
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> //TODO: Implement signature here<
|
|
|
|
|
and on this site is no source?
|
|
|
|
|
I don't know of any which of course does not mean they don't exist. Again, i can say, try searching with keywords like "file manager windows" or such around the forums and articles here. Many times google also has links to CodeProject with useful stuff. I hope you will find what you are looking for.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> //TODO: Implement signature here<
|
|
|
|
|
There is plenty, but you have to find it yourself.
|
|
|
|
|
What have you tried? Search in google and code project yourself. No-one will do homework for you.
|
|
|
|
|
Hi guys(and girls ),
i want to copy the data of a function, with the whole data, i mean, the whole function and execute it on the target memory. How do i realize it?
Is there a possibility to determine when the function ends? Is it possible to copy the function into the heap and execute it there ? Or has it have to be the Stack ?
I tried to look into it with a Debugger and so on, but couldnt get any information regarding the matter.
thanks in advance for every answer =)
btw. i use C (gcc)
|
|
|
|
|
Are you working on windows?
[EDIT] If you had said yes then i would have suggested the same thing as barneyman did "below". [/EDIT]
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> //TODO: Implement signature here<
modified on Friday, April 22, 2011 9:42 AM
|
|
|
|
|
have a look at the VirtualAlloc and VirtualProtect winAPI functions - you'll need to grant PAGE_EXEC rights (I assume you're doing this in Windows)
You'll know when the code finishes because the function will return back to you
|
|
|
|
|
thanks, but i am working under ubuntu.
And yes the function will return, but i have to copy it beforehand, before i execute it.
|
|
|
|
|
Try googling for linux equivalents of those methods. I hit mmap[^] for example, maybe that can do what you wish for VirtualAlloc, for VirtualProtect mprotect[^] might work.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> //TODO: Implement signature here<
|
|
|
|
|
damn, me silly =)thanks
but how about to determine the end of the function. Also i want to copy it into the heap and execute it there, but the heap is read not the same way the stack does. Would that cause any problems?
|
|
|
|
|
as long as the function executes a RET (or whatever is appropriate for the chipset you're using) you know when it finishes, because code execution will come back to you
Both the heap and the stack are still physical memory areas, it's largely down to what the OS will let you do with each
|
|
|
|
|
Ok i was analyzing the asm code in a debugger and found a solution. I used code from here: <a href="clickme">http://www.devmaster.net/codespotlight/show.php?id=25</a>
and modified it slightly to check on 0xC3(RETN), the return changed to func(in the end) - func(when you call the function). And vuala you have the length of the function in bytes
Now it is possible to just get the length without doing any marker whatsoever, btw i considered the markerthing, but that wouldnt be possible, not so easy anyways, because every opcode can differentiate between op length and so on.
|
|
|
|
|
The ret may not be at the end (address-wise) and in fact frequently isn't (well, depending on what compiler you use)
|
|
|
|
|
I'm not sure what you mean by the heap and stack read difference thing.
Finding out where your function ends (basicly, finding out its size) seems to be trickier than it sounds. I guess what you can do is simply query how big a page is and then guess how many pages your function uses up, or maybe have some special value somehow embedded into the code, like 0xDEADBEEF and look for it during runtime...have no better idea yet.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> //TODO: Implement signature here<
|
|
|
|
|
i understand the 'function end' reference now
You have a number of options, either hard-code the length of the function-copy as a result of manually analysing the map file, (or using the GCC equivalent of #pragma code-seg, put the function(s) in their own code segment) or insert (as code-o-mat says) a magic number at the end and emit a JMP opcode to get passed it
If you're doing some runtime code decryption, i'd go with the code-seg option
|
|
|
|