|
That may work, ExitThread and ExitProcess are nearly identical so I don't need to worry about the paramaters. Plus, since i'm running an exe, I don't need to worry about shared data, provided I only allow the execution of one thread at a time.
|
|
|
|
|
WalderMort wrote: To those who said running an exe from within the resource section is impossible :p I did it!
Hi WalderMort,
Can you please share us how you did that? I would like to learn that technique. what I used to do is to extract the binary in the resource and then run it either using the createprocess or shellexecute().
Thanks
|
|
|
|
|
When I have perfected the code I may create an article about it, but I fear it will just open the door to script kiddies. I'm not exactly sure how virus killers work, but using this method it would be possible to compress/encrypt malicious code into a resource, then decompress/decrypt and execute all from within the memory.
So far I have only been able to run console apps. Running windowed apps is proving to be a pain in the ****! I'm currently looking at methods of creating a process. The standard API's all expect file path, but I want to create an empty process and copy the code over myself. Again, this would avoid the need to first write to disk.
|
|
|
|
|
So what your now doing is just create some other process( may be in suspended mode ) and then replace the code in that application with the one in your resource?
|
|
|
|
|
I already thought of that, but there is no saying where the thread would be suspended. In most cases it gets suspended befone winmain is called, but the thread may have already started the initialization procedure; In which case it would be impossible to copy the code over without it crashing.
I need to mimic the winapi CreateProcess, but most of the ntdll functions are undocumented and there are very few examples of their usage.
|
|
|
|
|
ok. Anyway best wishes for your research. Will be waiting for your article.
|
|
|
|
|
hi all!
again i need help from the experts
can someone please help me out in how to access the database (ms sql server 05) and the result (each record) will be placed in a struct. hope someone can help and provide some sample codes.
thanks!
also another question.. i have a pointer to an array of structs... i would like to create another set (a smaller array) of pointer array based from that struct so i can delete the original array... how can i do this? thanks for all your help!
newbie
|
|
|
|
|
You may want to start by deciding what database access technology you're going to use...
For Microsoft possibilities, see: Data Access Technologies Road Map[^]
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi Mark. Tnx for the reply.
im going to use ado.
i have this sample code already... which returns only a single record.
what i am doing is i just get the values of the fields i need and assign it to a variable.
szSQL.Format(_T("select * from table where key='101'");
hr = pRS.CreateInstance(__uuidof(Recordset));
if (FAILED(hr))
return false;
if (!pRS->adoEOF)
{
pFields = pRS->Fields;
pField = pFields->Item[_T("id")];
_variant_t var = pField->Value;
szID = TrimBSTR(var.bstrVal).copy();
pField = pFields->Item[_T("count")];
var = pField->Value;
szCnt = TrimBSTR(var.bstrVal).copy();
}
now what i am not sure how to do is how to map the result of the query to structs if the return is multiple records. i would like to have the results of the query be stored in an array of structs. do i do the same thing of accessing each fields and creating the struct. i was hoping there is an easier way. thanks!
newbie
|
|
|
|
|
Am kinda new visual c++, is there anyway to use the header file afxwin.h in maybe Dev Bloodshed IDE, I want to create native button son MFC and i guess its wrong to use samn like CButton buttonname;
and also are the syntax and style of the c++ coding in VS6.0 different here in VS8.0?
ANY HELP? Thanks.
phatkin
|
|
|
|
|
I use VC2005.In a project,there is a dialog with a datagrid control.But when I move the project to antother PC,the dialog recouse couldn't be opened now.An assert occur,it tells me that the active contol was not registed!
Someone would like to tell me why? The environment of the two PC are same(VC2005)!.
Thanks.
GOOD LUCK
|
|
|
|
|
Good day. I am looking for a possibility to change windows message.
For example, when I insert a disk with corrupted file system and try to access it with windows explorer, I found out that windows explorer will prompt me a message "Please insert a disk into drive A:".
Is is possible for me to change the "Please insert a disk into drive A:" into another message like "Please format your disk..." or launching windows format or launching other application?
|
|
|
|
|
Hirakawa wrote: when I insert a disk with corrupted file system
How will you know the disk is corrupted versus the floppy drive just can't read the floppy.
Over the years in I.T., I have found that floppies formatted and populated by one box sometimes cannot be read by other machines. This seems to have gotten worse in the last several years.
Just because a floppy drive cannot read the disk does not necessarily mean the disk structure is corrupted. It may just have trouble picking up the flux reversals and hence voltage levels of the signal fall in the indeterminate region between high and low.
"Please insert a disk into drive A:" means I can't read your disk.
"Please format your disk" could be interpreted as, I can read your disk, but you disk structure is shot. However, we are not sure why it can't read the disk. It's probably safer to leave it open to other possibilities so the user still has some hope that another floppy drive may pick up on the flux reversals before suggesting they wipe out the data on the disk permanently.
Just my two cents
|
|
|
|
|
Thank you for your reply.
I just want to change the windows message or behavior. Whether disk is corrupted or floppy drive have problem is not in my consideration at the moment. I just want to explore the possibility to manipulate the windows message.
|
|
|
|
|
Hi Guys
i am trying to disable only External hard disk not USB Flash key.. which is being mounted from USB Port.
i am using DeviceIoControl for vlocking the device but it taks too much time. so in mean while people can hack the drive.
i want to do all at run time.. please it is very urgent
Thanks in advance
R e h a n
|
|
|
|
|
What control code are you using for DeviceIoControl()?
Does your program have sufficient administrator priviliges? (It must be running at administrator level for Device IO commands)
--PerspX
"Nowadays, security guys break the Mac every single day. Every single day, they come out with a total exploit, your machine can be taken over totally. I dare anybody to do that once a month on the Windows machine." - Bill Gates
|
|
|
|
|
I want to develop one program to solve screen recording , please give me an example,Thank you.
|
|
|
|
|
youthdragon wrote: I want to develop one program to solve screen recording
Have fun with that then
|
|
|
|
|
|
What do you want your program to do?
What are the tasks required to do this?
Which task(s) are you having trouble with?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Is it possible for a process to retrieve a Primary Token for whichever user account it is running under?
Can I then pass a handle of the token to an admin process, which would allow that admin process to use CreateProcessAsUser to create new processes in the context of the original user account?
Background:
I have a program that launches an updater program which requires admin privileges. After it performs the update, I need the updater to re-launch the main application, but under the regular user account, not the admin account.
This is Vista.
--------------------------------
"All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke
|
|
|
|
|
Why can't the main application be run from the admin updater program? It would run under admin privileges.. But does this matter?
--PerspX
"Nowadays, security guys break the Mac every single day. Every single day, they come out with a total exploit, your machine can be taken over totally. I dare anybody to do that once a month on the Windows machine." - Bill Gates
|
|
|
|
|
Thanks for your reply. Unfortunately, it actually does matter which account it runs under, because a lot of application config is user account-specific, so the app must be run under the account of the person who wants to use it.
--------------------------------
"All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke
|
|
|
|
|
You could do something like create a small "in-between" program, running at user level, which runs the program set at admin level, and then runs the user-level app again? Or something similar to this?
Also, I'm sure that there is an API for elevation of an application.. So you create your admin-level application running as a user then elevate it to admin level?
Also, does this admin app have to run the user level app again? Can't you just hide the main window whilst the admin application is running, and get the admin level app to show it after it has finished?
I hate Vista too
--PerspX
"Nowadays, security guys break the Mac every single day. Every single day, they come out with a total exploit, your machine can be taken over totally. I dare anybody to do that once a month on the Windows machine." - Bill Gates
|
|
|
|
|
Yes, your "in-between" idea might work. Thanks very much.
I wouldn't be able to keep the user-level app running while the admin app is doing its thing, because the admin app is an updater whose job is to replace application binaries with new versions!
So your in-between program idea might work as long as the in-between program itself never needs updating......
But I will seriously consider your idea if I can't find anything more direct.
Thanks very much!
--------------------------------
"All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke
|
|
|
|