|
Hi
Run as administrator works fine for administrator account but when I run the application (as administrator) in a guest account, the application seems to change the settings of administrator instead of the guest account and thereby defeating the purpose of the application.
Eg : If I have proxy enabled in Administrator account and running (as administrator) the application in guest account disables the proxy of the administrator.
The behavior seems quite logical since I am asking the application to run as administrator instead of guest and hence use the administrator environment.
So coming back to my very first mail, the problem in guest account is that CoCreateInstance returns E_ACCESSDENIED.
Is there some way to use the function to run with elevated privileges ?
Or is it that COM objects can not be used in a guest account (which I think should not be the case)?
Thanks
Manoj
|
|
|
|
|
manojsaxena_mca wrote: Eg : If I have proxy enabled in Administrator account and running (as administrator) the application in guest account disables the proxy of the administrator.
Sorry, I'm lost here, as far as I know you can run any application with elevated privileges.
manojsaxena_mca wrote: Is there some way to use the function to run with elevated privileges ?
Or is it that COM objects can not be used in a guest account (which I think should not be the case)?
I have not come across this but the elevated privilege should be carried across from the original app to the COM object. I cannot see that Windows could work otherwise.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
Hi Richard
Both of your comments in the previous reply are true, but what I could figure out: "running as administrator" my application in guest account runs the application using the environment (variables etc) of "administrator" account rather than that of the "guest" account. In other words, effectively the application runs as if it is running in administrator account instead of guest.
Hence application made any changes (disabling proxy, in my case) to administrator and not to guest.
Regards,
Manoj
|
|
|
|
|
That is what I would expect to happen. It should be easy to check just by running a cmd shell as adminstrator and see what you get access to.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
How to run a win32 .exe which takes 2 command line perameter with ShellExecute API ?
|
|
|
|
|
Pass both parameters in a single string as the lpParameters argument.
|
|
|
|
|
Look at the ShellExecute Function (Windows)[^] documentation on the MSDN: you have to use the lpParameters argument. Here below is an example:
ShellExecute(NULL, "open", "notepad.exe", "/P myfile.txt", NULL, SW_SHOW);
|
|
|
|
|
This is not working..
I am passing like
CString cmdArg = _T("-x ") + szUpdateFilePath;
::ShellExecute(NULL, _T("open"), szUnZipExePath,cmdArg , NULL, SW_SHOW);
I need to pass like
unzip.exe -x file.zip
Anything wrong?
|
|
|
|
|
john5632 wrote: This is not working..
Which means what exactly?
Try using string literals as the third and fourth arguments to ShellExecute() . Once you get that going, then you can go back to using variables.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Are you sure szUpdateFilePath contains what you think it contains?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Leela: Fry, you're wasting your life sitting in front of that TV. You need to get out and see the real world.
Fry: But this is HDTV. It's got better resolution than the real world <
|
|
|
|
|
|
Does szUpdateFilePath contain spaces perhaps? If yes, enclose it with quotation marks, e.g.:
Cstring cmdStr = _T("-x \"") + szUpdateFilePath + _T("\"");
Also, try this:
CString exec = szUnZipExePath + _T(" -x ") + szUpdateFilePath;
::ShellExecute(NULL, _T("open"), exec,NULL , NULL, SW_SHOW); and see if it changes anything or not.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Leela: Fry, you're wasting your life sitting in front of that TV. You need to get out and see the real world.
Fry: But this is HDTV. It's got better resolution than the real world <
|
|
|
|
|
|
Actually, why does it not work? What are the sympthoms i mean.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Leela: Fry, you're wasting your life sitting in front of that TV. You need to get out and see the real world.
Fry: But this is HDTV. It's got better resolution than the real world <
|
|
|
|
|
It should unzip the file and create 2 folder and contents. When I am running using command prompmt the same is working fine. but it is not working in code.
|
|
|
|
|
If you check out the documentation for ShellExecute[^], it states that you get error codes -if any- in the returned value, what does the error code tell you?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Leela: Fry, you're wasting your life sitting in front of that TV. You need to get out and see the real world.
Fry: But this is HDTV. It's got better resolution than the real world <
|
|
|
|
|
Its returning 0(The operating system is out of memory or resources.). Can you tell me why this is happening. plzz.
|
|
|
|
|
Which version? Your original or the one i suggested? Try your version if you haven't.
Btw i did a small test app and it runs unzip.exe without problems, i suspect that the problem is with your parameters, maybe the path to your executable is too long or the parameter string is. If you don't specify any arguments, just try to run the exe, does it work?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Leela: Fry, you're wasting your life sitting in front of that TV. You need to get out and see the real world.
Fry: But this is HDTV. It's got better resolution than the real world <
modified on Friday, October 22, 2010 2:07 PM
|
|
|
|
|
|
What is the reason of failure in ICaptureGraphBuilder2::RenderStream() with .mpg files? HRESULT is 0x80004005
Чесноков
|
|
|
|
|
That HRESULT value stays for E_FAIL which has no more specific details. Have a look at the documentation of ICaptureGraphBuilder2::RenderStream[^] on the MSDN; on the remarks section there are 2 sentences that could help you:
- If pSource is a filter, the method searches for an output pin on that filter. In that case, use the pCategory and pType parameters to narrow the search. For example, if a filter has separate pins for preview and capture, you can specify either PIN_CATEGORY_CAPTURE or PIN_CATEGORY_PREVIEW. If pSource is an output pin, set the pCategory and pType to NULL.
- File Sources. You can use this method to transcode or recompress a file. The following discussion assumes that the file has at most one video stream and one audio stream, or else a single interleaved stream. Otherwise, the method will not work correctly. A file source has one output pin, so set pCategory and pType to NULL. Call the method twice — once to render the video stream, and once to render the audio stream. The first call connects the source filter to a parser filter and renders one of the parser filter's output pins. The second call renders the parser's remaining output pin. If you are compressing one stream but not the other, make sure to specify the compressor filter in the first call. The method will automatically pick the correct stream based on the compression type.
|
|
|
|
|
I use intelligent connect. It should find all pins and connects them together automatically? How do I need to manage those pins manually?
IBaseFilter *pSrcFilter = NULL;
hr = m_pGraph->AddSourceFilter(fileName, L"Source Filter", &pSrcFilter);
if (FAILED(hr))
return -3;
IBaseFilter* pGrabberFilter = NULL;
hr = AddSampleGrabber(&pGrabberFilter);
if (FAILED(hr)) {
pSrcFilter->Release();
return -4;
}
IBaseFilter* pNullFilter = NULL;
hr = AddNullRenderer(&pNullFilter);
if (FAILED(hr)) {
pGrabberFilter->Release();
pSrcFilter->Release();
return -5;
}
hr = m_pCapture->RenderStream(NULL, NULL,
pSrcFilter, pGrabberFilter, pNullFilter);
Addition of the NULL renderer and sample grabber are typical from MSDN
IBaseFilter* pFilter;
hr = CoCreateInstance(CLSID_NullRenderer, NULL, CLSCTX_INPROC_SERVER,
IID_IBaseFilter, (void **)&pFilter);
if (FAILED(hr))
return hr;
*ppNullFilter = pFilter;
hr = m_pGraph->AddFilter(pFilter, L"Null Renderer");
if (FAILED(hr)) {
pFilter->Release();
return hr;
}
(*ppNullFilter)->AddRef();
pFilter->Release();
Чесноков
|
|
|
|
|
Look at these pages from MSDN:
|
|
|
|
|
Why intelligent connect fails with .mpg files but works with others as .avi, .mp4?
Чесноков
|
|
|
|
|
If I set those parameters it returns 0x80070057
RenderStream(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video, pSrcFilter, pGrabberFilter, pNullFilter);
Чесноков
|
|
|
|