|
I developed a ASP component which can create process,I want it run a program which will product some files,but the problem is the ASP component created process and didn't product files.
the code is follow:
STDMETHODIMP CWebExam::CompileFile()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState())
// TODO:
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
// Start the child process.
if( !CreateProcess( NULL, // No module name (use command line).
"e:\\web2\\exam\\cl.exe /Fee:\\web2\\exam\\ /Foe:\\web2\\exam\\ e:\\web2\\exam\\test2.cpp", // Command line.
NULL, // Process handle not inheritable.
NULL, // Thread handle not inheritable.
FALSE, // Set handle inheritance to FALSE.
0, // No creation flags.
NULL, // Use parent's environment block.
"e:\\web2\\exam\\", // Use self starting directory.
&si, // Pointer to STARTUPINFO structure.
&pi ) // Pointer to PROCESS_INFORMATION structure.
)
{
error=1;
//MessageBox(NULL,"create process wrong",NULL,MB_OK);
}
else
{
error=0;
}
// Wait until child process exits.
WaitForSingleObject( pi.hProcess, INFINITE );
// Close process and thread handles.
CloseHandle( pi.hProcess );
CloseHandle( pi.hThread );
return S_OK;
}
|
|
|
|
|
Difficult to say, but I would check the rights - because I think that the process running under the IIS web account (this IUSR_xxx), so it might be that it have no rights to create a file or do any other action.
If it runs when started normally (under your account), it will probably be some rights problem.
|
|
|
|
|
sorry!I think I didn't write the problem clearly!
In this component ,I have a property named "Eror",it will return a value which points out the process is created or not.
To test this component ,I set the IIS web account as administrator,also I create a asp page,created the component,run the method,after this,I checked the "Error"'s value ,to my superise,I found it created a process successed. but it didn't product any outfiles.
I doubt that it maybe has something to do with the environment of the process running.
Thank your reply!
|
|
|
|
|
I have been using an ActiveX control for controlling the printing of some specific pages. I followed the examples of msdn and how they use print templates and printing programmatically... but now I have one major problem that i cannot seem to fix.
I have provided a print, and preview button in the page to invoke my control's own printing, but when the user selects print from the file menu or ctrl+p, internet explorer does its own printing. What I wanted to do is that my control should take over all printing operations so long as the user is viewing that report.
I know this is possible because ScriptX has an event called user_print and user_preview and I wanted to know how such an event could be achieved.
The ideas that I had so far are the following:
1. CBT Hooking
2. Capture the necesary events from a pointer to WebBrowser2
3. Using Javascript, capture onbeforeprint and use my own
But the above 3 things all didnt work out in my experience, first, the CBT Hooking didnt exactly allow me to drill down into the webbrowser instance, it did however, allow me to capture the print dialog and replace the action of the OK button. But what about when the user presses the print icon in IE. Also, what about when the user presses the print icon from the preview window. The javascript event doesnt cancel so if I just call my own print function when that event is called, it goes into an infinite recursion and a stack overflow and it causes internet explorer to be terminated. The second one is the only one that still might have any hope. I just dont know enough about COM/ATL to be able to capture events from an interface.
So to wrap it up, I have 2 functions in the activex, Print, Preview, and PrintNoPrompt
Print first shows the print dialog and prints
Preview just previews the page
PrintNoPrompt just prints the page without showing the prompt
I was wondering if there was a way to do the following:
First, Redirect CTRL+P, File->Print, Rightclick->Print to my Print function. Second, Redirect File->Preview and Print Preview icon on toolbar to my Preview function. And finally, Redirect Print icon on toolbar to my PrintNoPrompt function.
If anyone can help me figure this out, it will be greatly appreciated.
MoMad the NoMad
|
|
|
|
|
OK to rephrase this question:
How do I sink WebBrowser events from an activeX Control inside the webbrowser?
MoMad the NoMad
|
|
|
|
|
I am not sure what exactly are you asking....
My guess would be to implement interface OleCommandTarget on COleControlSite, make your own Exec and check for nCmdID == OLECMDID_PRINTPREVIEW || ...
|
|
|
|
|
I want to know how to intercept internet explorer events such as menu item click or clicking on a toolbar item, or pressing a hot key like ctrl+p.
MoMad the NoMad
|
|
|
|
|
Can COM interface pointers be used as reliable identities?
Please consider this out-of-proc scenario:
'VB Code
obj.MethodCall aCOMObject
...
obj.MethodCall aCOMObject
obj.MethodCall aCOMObject results in a call to my C++ method:
STDMETHODIMP CClass::MethodCall(IInterface* pIf)
{
...
}
My question is now; will the pointer pIf always contain the same value in all calls from the client (in this case VB)? Can I use this interface pointer to uniquely identify the object no matter what type of client is calling? Is this perhaps controlled by the MIDL interface attribute pointer_default ?
I know it'll work in an in-proc C++ only scenario, but I cannot guarantee that this will always be the case.
--
we dance to the sound of sirens
and we watch genocide to relax
we dance to the sound of sirens
we are the heroes of self-deception
|
|
|
|
|
I think, that if you will receive the calls from the same object in the same thread, you have to receive the same value.
But as long as you cannot guarantee that this will be always your case, I will not rely on such a mechanism, as it could bring lot of weird problems.
|
|
|
|
|
All,
I'm looking to build a plug in architecture where individuals can create VB ActiveX DLLs to be used by my application. I have seen this done with products like ViewStar. The catch is, to maximize performance, I'd like to be able to use the vTable of the ActiveX DLL.
So, I'd like to have the following:
The VB ActiveX DLL would have a specific interface. For example, the following Methods:
Function ApplicationStart(...)
Function ApplicationClose(...)
How do I call the methods via the vTable from my Visual C++ application?
I would appreciate any help.
Thanks,
Rich
|
|
|
|
|
Hi.
I have a whole bunch of DLLs on a server and I want to trace the CreateObject calls within the DLL classes so I can see how things are linked together.
I know that the whole concept of compiled DLLs is to encapsulate the implementation. However, is there a way to efficiently and accurate trace through these DLLs?
|
|
|
|
|
I have a COM+ component. Until now i have only clients hosted into the same computer like my business component.
Now is needed to have clients on other computers, over the net, who must access data from my COM+ component.
The way is to deploy a DCOM component and make calls from clients to that DCOM.
But i dont want to copy the code from my COM+ component into the new DCOM component.
I know is possible to make a com to be like an exe DCOM, but i dont know how... Know somebody how ?
Adrian Bacaianu
|
|
|
|
|
Since this is a COM+ component, you can instantiate it remotely too. You don't have to write a new DCOM server - thank God! (How would you provide all COM+ services in the DCOM server after all? rewrite them?)
Just call (from VB/VBScript)
Set obj = CreateObject(ProgID, Remote server name)
and you' ll get a remote instance of your component.
For C++ code, CoCreateInstanceEx will do the trick.
For DCOM to work, you need ports 135 & 1024-65535 open between your machines.
Hope I helped.
|
|
|
|
|
Yes, was working, many thanks!
The speed isnt so good but that it is...
Adrian Bacaianu
|
|
|
|
|
I have two classes, classA and classB.
Both these classes have got only pure virtual functions and nothing else.
But ClassA has got aggregation relationship with classB. For more clarity let us say, classA contains classB.
My question: whether classA can be treated as a COM compatible inteface.
Here my question is, whether this aggregation relationship does effect this ClassA not to be tratred as an Interface, as per COM spesification.
My requirement is that, when I create an object (component)of classA
say ObjA.
ObjA should also contain an object of classB say ObjB.
So that when ever I call a method on objA, it should be possible to delegate
or forward this call to objeB.
Thanks in advance for clarification.
Regards
Hara
Hara
|
|
|
|
|
Why OLECHAR* maps to 'ref ushort' in c#?
And how do I pass strings.
Do I have to declare array: ushort[] arr = new ushort[100] fill with ascii codes and supply
'ref arr[0]'
I'm having problems with the following function:
IMarkupPointer::Right(BOOL fMove, MARKUP_CONTEXT_TYPE* pContext, IHTMLElement** ppElement, long* pcch, OLECHAR* pchText);
Please help
|
|
|
|
|
Everything works fine with ushort array , I wish there were some easy convertion between array of uchar and string
|
|
|
|
|
it is possible by writing a few lines code.
if you want to know how, please have a look at my articles or e-mail me
make a search by author fkocak
yours,
Fırat Koçak
Doing something is better than doing nothing. So ... Move !
|
|
|
|
|
Whenever I want to create an out-of-proc COM server,I use MFC application wizard to generate Dialog based Application with Automation support. Then i delete all the dialog related stuff from it, derive a new class from CCmdTarget and implement functions that external applications can call.
Now i want to fire events from such out-of-proc server. Can anyone tell me how can i do so?? Any sample application would be extremely welcome.
|
|
|
|
|
- Create a simple ATL Object.
- Create an event interface (dispinterface, see MSDN docs)
- Right click on the ATL class generated in step 1 and choose Add Connection Point. Select your event interface, and click ok.
- Use the
Fire_XX methods generated by the event proxy class.
It's real easy, you'll figure it out.
--
we dance to the sound of sirens
and we watch genocide to relax
we dance to the sound of sirens
we are the heroes of self-deception
|
|
|
|
|
Hi,
Does somebody know a secure solution to ensure that the DLL an application
is talking to hasn't been replaced with a fake one?
I am thinking about implementing a "handshaking" procedure. With this
method, the application sends a "challenge" random message to the DLL. The DLL responds with a value calculated using a one-way hash function. The application checks the response against its own calculation of the expected hash value. If the values match, the authentication is acknowledged; otherwise the application is terminated.
Do you know other/better solutions? Does COM provides some solution?
Remark: I am developing both the application part and the DLL part.
Thanks.
antoine
|
|
|
|
|
COM itself doesn't provide any solution for this (somehow you can use Licencing, but it is very easy to break).
Your solution can work, but have one weakpoint - it is quite easy to crack, because when the someone would like to switch the DLLs, he needs only to know the one-way hash you are using - if you will choose some standardized, say MD5, he can only with this knowledge calculate correct hash and return it to you exactly as your original DLL does. It is in fact secured only by the alg. of the one-way hash, and this alg. is stored in exe as well as in the DLL, so everybody can look to it and copy it.
Little bit better is a signing the code. If you will use the public key cryptography, the theory is simple, you have to calculate the cryptographic checksum of the DLL. Then the hash result is signed by your private key and stored in DLL.
In runtime, you take this blob from the DLL, calculate hash (of course except modified parts), compare it with the stored one and verify the signature by your public key stored say in a resources of the exe file. If the hashes match and the signature is OK, you are on the safe side.
This method is a bit safer, but also have some problem. It is quite easy to remove the checking code from exe .
In fact, there is no perfect software solution and depends only on the level of security you require for your application.
But in any case, there is a simple helper rule which says, if the system is secured, independently on the method you will use - If the costs for breaking such a system is higher (better significantly higher) than the benefits you can have from it, the system can be considered as safe.
Sorry for such an elaborate, but it is a deep night here and I cannot sleep somehow today...
|
|
|
|
|
Forget dynamic linking if you want security. There are about 1001 different ways of intercepting a dynamically loaded DLL.
To make it as hard as possible, do static linking. At least then you put the cracker to work.
To be real pessimistic, there is no real way to protect software in currently available mainstream operating systems. Nobody has a rigid set of security policies implemented. There will always be ways to trick the system, some harder than others.
--
we dance to the sound of sirens
and we watch genocide to relax
we dance to the sound of sirens
we are the heroes of self-deception
|
|
|
|
|
IEnumVARIANT *scrap;
IUnknownPtr Collection;
ConstraintsPtr ConstraintsList(GetConstraintsDispatch());
if (ConstraintsList->GetCount() > 0)
{
Collection = ConstraintsList->Get_NewEnum();
Collection->QueryInterface(IID_IEnumVARIANT, (void **)&scrap);
For some inexplicable reason the QueryInterface call above has suddenly stopped working...returning E_NOINTERFACE. It worked last week. It works on other machines in the office. It just doesn't work on mine. (This is old code that hasn't been modified in years and has never failed before...)
Any ideas? Tips? Anything? Anyone?
Please
Dan
|
|
|
|
|
Sussed it, the following registry sub-keys, inexplicably, were AWOL:
[HKEY_CLASSES_ROOT\Interface\{00020404-0000-0000-C000-000000000046}\NumMethods]
@="7"
[HKEY_CLASSES_ROOT\Interface\{00020404-0000-0000-C000-000000000046}\ProxyStubClsid]
@="{00020421-0000-0000-C000-000000000046}"
[HKEY_CLASSES_ROOT\Interface\{00020404-0000-0000-C000-000000000046}\ProxyStubClsid32]
@="{00020421-0000-0000-C000-000000000046}"
Mad!
Dan
|
|
|
|
|