|
thanks a bunch, ill give it a try!
-dz
|
|
|
|
|
my question regards the MS browser control , but this seemed the most appropriate forum.
Does anyone know whether it's possible to affect the security domains of windows and frames presented within the browser control selectively - eg. for different window instances to possess alternate security levels. I'd like to develop a BC based app. that possesses security characteristics similar to those of an HTA. This is primarily to allow script originating from one domain to affect pages from a foreign domain without providing the foreign domain a 'Trusted' status relative to the top level window. Essentially I'm trying to get the BC instance to behave like an HTA.
Any advice a/o leads on resource will be appreciated - I'm new to windows development.
Thanks
David
|
|
|
|
|
I've been asked to write a program that will start another program up and then log all calls it makes to WriteProcessMemory() and any changes it makes to its variables. Is this even possible and if so where would be a good place to start looking?
Thanks
|
|
|
|
|
Intercepting WriteProcessMemory() is possible using API hooking techniques. (There are articles about this here at Codeproject.)
However, WriteProcessMemory() is usually used only to modify memory in foreign processes. If you need to monitor what the process does on its own address space you are nearly out of luck. This means that you have to write a debugger that connects to the target process, halts all threads and single steps them to monitor the changes. Really, really hard work!
--
Daniel Lohmann
http://www.losoft.de
(Hey, this page is worth looking! You can find some free and handy NT tools there )
|
|
|
|
|
Thanks for the reply, sounds nasty. Might have to tell the guy that its going to take a while if it'll be done at all. I wasn't expecting it to be easy to check the variables of another process but that sounds a little out of my league just now, maybe in a couple of years
Thanks again
|
|
|
|
|
carrie wrote:
Thanks for the reply, sounds nasty. Might have to tell the guy that its going to take a while if it'll be done at all. I wasn't expecting it to be easy to check the variables of another process
I think he miss-read your question. It is nasty to do that to the program's own process, but your program is going to start another program with the CreateProcess function, right? If that's the case then it won't be as hard as because you your program can intercept all the other programs messages amd can easily log it. Look for windows hooks at msdn.microsoft.com.
|
|
|
|
|
carrie wrote:
I've been asked to write a program that will start another program up and then log all calls it makes to WriteProcessMemory() and any changes it makes to its variables.
What value can you get out of this output, seriously curious here. Is the idea to detect memory flaws in a programs process? How do you analize this?
Nick Parker
|
|
|
|
|
Maybe something like BoundsChecker would work for you.
When someone asks you for the impossible maybe it's time to ask them what they really want.
Todd Smith
|
|
|
|
|
hehe, thanks for all the help guys, more pointers are always welcome
My program would be starting the other process up so I'll take a good look at hooks(thanks). The main reason for doing it is because there is a group of us working on a set of programs. We're all students and bored doing the usual 2nd year programming stuff so we're writing some other games and apps and taking requests from local businesses for fun.
Just now the way we work it is that we have everyone send in the executables once they're finished their programs but we're trying to get this program and the ftp site-to-site program up and running to make life easier. Because we don't send the sources around we like to be able to check that our programs are working on others machines as well so we can then pass them on.
Anyway, thanks for the tips and keep them coming if anyone knows the solution to my CFtpConnection::Command problems feel free to help
|
|
|
|
|
What does that mean? The messagebox appears and it goes into assembly debugging, i'm trying to enumerate all the available compression driver on the system, here's the code:
void onConvert()
{
acmDriverEnum((ACMDRIVERENUMCB)listCallback, NULL, ACM_DRIVERENUMF_DISABLED);
}
BOOL WINAPI listCallback(HACMDRIVERID hadid, DWORD dwInstance, DWORD fdwSupport)
{
if (fdwSupport == ACMDRIVERDETAILS_SUPPORTF_CODEC)
{
ACMDRIVERDETAILS details;
int box;
int test;
details.cbStruct = sizeof(details);
box = acmDriverDetails(hadid, &details, NULL);
SendMessage(GetDlgItem(ghWnd, IDC_CODECS), LB_ADDSTRING, 0, (LPARAM)details.szLongName);
}
return true;
}
First i call the onConvert and then it uses the listCallback function to enumerate the different drivers.
Thanks in advance
-Redeemer
|
|
|
|
|
Hm...
- Did you placed a breakpoint on the very first statement of your listCallback?
- The cast to ACMDRIVERENUMCB for the first parameter to acmDriverEnum() should not be necessary. If the compiler complains about it, there is something wrong.
--
Daniel Lohmann
http://www.losoft.de
(Hey, this page is worth looking! You can find some free and handy NT tools there )
|
|
|
|
|
I have a dll that I would like to embed in an exe so I only have to distribute one file with out extracting. Is there a way to put the dll in the exe and still be able to access its functions?
Thanks,
Clint
|
|
|
|
|
you could attach it to the end of the EXE and extract it at runtime, then use LoadLibrary/GetProcAddress to access the functions.
-c
Conservative:
One who admires radicals centuries after they're dead.
-- Leo C. Rosten
|
|
|
|
|
I was hoping to avoid making a temp file. Are there any other ways or is this pretty much the only way?
If this is the only way how does one extract a dll? I am still learning how resources work, over and above icons.
|
|
|
|
|
i don't think it's the only way, but it might be the only way without getting into some serious low level stuff.
you could put it in a resource, sure. that would be the most VisualStudio-friendly way. it would take about ten lines of C (plus error checking) to get the DLL out of memory and into a file - no big deal.
or, you could concatenate the DLL onto the end of the EXE, using an external app, with a length DWORD at the very end, so you know how many bytes to extract from the EXE. this method is trickier and might not be worth the effort. the resource method is probably safer.
HRSRC hRsrc = FindResource(hInstance, pName, "DLL");
if (hRsrc)
{
HGLOBAL hGlobal = LoadResource(hInstance, hRsrc);
if (hGlobal)
{
BYTE *pDLL = (BYTE *)LockResource(hGlobal);
DWORD dwSize = SizeofResource(hInstance, hRsrc);
... now open a file, and write the dwSize BYTEs starting at pDLL to a file.
UnlockResource(hGlobal);
FreeResource(hGlobal);
...
-c
Conservative:
One who admires radicals centuries after they're dead.
-- Leo C. Rosten
|
|
|
|
|
Thanks, it doesn't look too hard.
Cheers,
Clint
|
|
|
|
|
One more tip:
If you link to your dll with delay loading, you do not have to trickle with GetProcAddress() and can also easily export/import classes.
--
Daniel Lohmann
http://www.losoft.de
(Hey, this page is worth looking! You can find some free and handy NT tools there )
|
|
|
|
|
What do mean about delay loading? Did you mean runtime linking? Any examples?
|
|
|
|
|
when you build the DLL, it will build a .LIB file that contains stub function calls. if you link to this .LIB, it will handle the LoadLibrary/GetProcAddress stuff for you - you just call the DLL functions as if they were from a static library.
there may be some compiler switch necessary to enable the creation of this .LIB, but it's an easy one to find, IIRC.
-c
Conservative:
One who admires radicals centuries after they're dead.
-- Leo C. Rosten
|
|
|
|
|
Link to the DLL (means link to the .lib file of the DLL) as if you want to load it implicitly. Pass a /DELAYLOAD:MyDLL.dll command line switch to the linker.
In this case the linker does not really link the dll as implicit loaded, but provides stubs for all DLL functions. Loading of the dll is delayed until the first call to the dll.
This gives you the possibility to unpack your DLL from the resource to disk before you call it first time. Otherwise (if linked implicitly) the loader will complain about "MyDLL.dll could not be found".
Delay loading is explained in detail in the VC docs and in tons of MSDN articles.
--
Daniel Lohmann
http://www.losoft.de
(Hey, this page is worth looking! You can find some free and handy NT tools there )
|
|
|
|
|
Place your dll in with the resource data of your application. Inclusion is straightforward: place your dll in the source directory of your application, and add the following line to your .RC file:
<br />
DATNT BINRES MOVEABLE PURE "NAMEOFYOURDLL.DLL" <br />
Now, within the initialization of your application, load the resource and write it out to a temporary file.
<br />
HRSRC hRsrc;<br />
HGLOBAL hResource;<br />
DWORD dwSize; <br />
LPVOID lpvDll;<br />
HFILE hfTempFile;<br />
•<br />
•<br />
•<br />
<br />
hRsrc = FindResource(hInst,MAKEINTRESOURCE(DATNT),"BINRES");<br />
<br />
hResource = LoadResource(hInst, hRsrc);<br />
dwSize = SizeofResource(hInst, hRsrc);<br />
lpvDll = LockResource(hResource);<br />
<br />
hfTempFile = _lcreat("tempname.tmp",0);<br />
_hwrite(hfTempFile, lpvDll, dwSize); <br />
_lclose(hfTempFile);<br />
At this point, you'd dynamically load your dll. Once it is loaded, you can safely delete the temporary file.
|
|
|
|
|
A couple of commercial options:
Dll to Lib http://www.binary-soft.com
Fusion http://www.bit-arts.com (although I'm having problems with their site)
Joel Lucsy (jjlucsy@ameritech.net)
|
|
|
|
|
|
FILE *fp;
fp = fopen(filename, mode);
fclose(fp);
There are open file but
I would like to know the instruction showing directory list.
somebody help me... thank a lots
|
|
|
|
|
see FindFirstFile and FindNextFile
also, there are a number of classes on this site that encapsulate this operation
-c
Conservative:
One who admires radicals centuries after they're dead.
-- Leo C. Rosten
|
|
|
|