|
R.ilan thendral wrote: Question 1:
When we create an COM object in a Process where does the memory of the COM objects get allocation?
Wherever the code that implements the class factory allocates it. Typically this will be on one of the heaps but sometimes a small number of static objects are used.
Question 2:
Does the memory allocated to the COM object contributed to increase in Virtual memory of the process where it is instantiated.?
Potentially. The heap manager manages a large block of virtual address space for each heap, so sometimes allocating from the heap can be satisfied from the existing virtual address space allocated to the heap, and sometimes the heap has to grow to satisfy the new allocation.
Question 3:
What is the relation between virtual memory of a process and private bytes of the process?
It's hard to do justice to that question in a small amount of space. The virtual address space is how the process views memory; at any time, most of the virtual address space isn't backed by anything - if you try to write to or read from them, you just get an access violation. Virtual addresses can be mapped to memory-mapped files, shared memory sections, can be marked as reserved, or can point to memory that can only be accessed by this process - these are 'private bytes'.
Task Manager confuses everything by referring to 'private bytes' as 'VM Size'.
In turn, only some of the process's virtual addresses are actually in physical memory at any given time. The working set ('Mem Usage' in Task Manager) is the set of pages belonging to the process (memory-mapped files, shared, or private) which are currently in physical memory. The processor and operating system work together to give the illusion that the code and/or data are all accessible; if the process references (reads from or writes to) a page not currently in physical memory, the processor raises a page fault exception, which the OS handles by reading the page from disk, then setting a data structure (the page table entry) to point to the physical memory containing that page.
|
|
|
|
|
Hello all,
I have a COM component on a remote server with no DllSurrogate = "" value set in the remote registry.
So, the instantion could not be done in the server side only.
I made a method to access the remote registry primitives, using the pipe \\PIPE\winreg and also using the rpc.rcacn_np transport. So, this way I'm able to modifying the registry remotely, putting the DllSurrogate="" and performing the COM instantiation.
Everything is working fine, but now I must do all of this without file and print sharing, which means that I'll not be able to use the PIPE anymore. So I'm looking for some COM with DllSurrogate="" already enabled that expose some function to modify my component. Or some service working at port 135 or 445 with some exposed methods to do the same thing, this way I can access using the rpc.rcacn_ip_tcp.
So, any ideas. Thanks in advance.
Raphael Amorim Dantas Leite
|
|
|
|
|
Hello,
In the case you described I prefer to use WMI (Windows Management Instrumentation). It's an ultimate tool for making a kind of administrative work both on a local and remote computer under Windows XP & 2000. WMI "System Registry Provider" gives a full control on registry DB. You have to have administrative rights to perform any registry write operations on a remote PC, of course.
If you are interested in using WMI, write me, I may share a simple project with you as an example of administration via WMI.
Regards,
ISerik
|
|
|
|
|
Using WMI from Linux? The only way is using the COM WBEM Scripting locator and it's not automated by default. We MUST change the registry like I said.
Raphael Amorim Dantas Leite
VC++, Java and C# programmer. Win32 and PocketPC enviroments
|
|
|
|
|
i want to programatically call WindowActivate event of word object..
how can i?
"You can do any thing you set to your mind" - theGhost_k8
|
|
|
|
|
Hello, all.
I have windows service. This following code in a application:
CoInitialize(0);
HRESULT hr;
SHDocVw::IShellWindowsPtr spSHWinds;
hr = spSHWinds.CreateInstance (__uuidof(SHDocVw::ShellWindows));
I get error: "Class isn't register".
|
|
|
|
|
It may be due to that a Service by default runs on a different (non visible) windows station.
Try setting the Service up to start as a specific user.
1. Go to the Start Menu, Select Run and type "services.msc" and press return.
2. Select your Service, right click and choose "Properties"
3. Select the "LogOn" tab and enter in the details of a valid user.
Or it could be that you need to check the "Allow Service to Interact with
Desktop" checkbox.
regards,
Darka [ Xanya]
"I am not a slave to a god that doesn't exist."
|
|
|
|
|
I create service with SERVICE_ALL_ACCESS, SERVICE_WIN32_OWN_PROCESS and SERVICE_INTERACTIVE_PROCESS
|
|
|
|
|
Did you try my first suggestion of changing the Service to run as a specific user account ?
Darka [ Xanya]
"I am not a slave to a god that doesn't exist."
|
|
|
|
|
Ok, if the service run in other user account it work. But it is necessary to start service from LocalSystem account.
|
|
|
|
|
Then you need to impersonate another user, see the LogonUser() and ImpersonateLoggedOnUser() functions.
Darka [ Xanya]
"I am not a slave to a god that doesn't exist."
|
|
|
|
|
I am sorry. And it is impossible little bit more in detail? I all time developed programs on a low level. Simply we had a situation, that more anybody is not present at the moment, and to make it is necessary urgently.
|
|
|
|
|
Try something like this:
<code>TCHAR szDomain[] = 'DomainName';
TCHAR szUserName[] = 'Username';
TCHAR szPassword[] = 'Password';
HANDLE hUser = NULL;
BOOL bLoggedOn = LogonUser(szUserName, szDomain, szPassword, LOGON32_LOGON_NEW_CREDENTIALS, LOGON32_PROVIDER_WINNT50, &hUser);
if(!bLoggedOn)
{
DWORD dwErr = GetLastError();
return;
}
if(!ImpersonateLoggedOnUser(hUser))
{
DWORD dwErr = GetLastError();
return;
}
CoInitialize(0);
SHDocVw::IShellWindowsPtr spSHWinds;
HRESULT hr = spSHWinds.CreateInstance (__uuidof(SHDocVw::ShellWindows));
RevertToSelf();
Darka [ Xanya]
"I am not a slave to a god that doesn't exist."
|
|
|
|
|
|
IElementBehaviorFactory* pEBFactory = NULL;
//Create my com object of implementing IElementBehaviorFactory interface
CoCreateInstance(CLSID_Factory, NULL, CLSCTX_INPROC_SERVER,IID_IElementBehaviorFactory, (void**)&pEBFactory);
//Mashal IElementBehaviorFactory
hr = CoMarshalInterThreadInterfaceInStream(IID_IElementBehaviorFactory, pEBFactory, &pStm);
The return value hr is 0x80004002, why?
|
|
|
|
|
0x80004002 has the symbolic name E_NOINTERFACE .
IID_IElementBehaviorFactory : {3050F429-98B5-11CF-BB82-00AA00BDCE0B}
On the face of it the return value of E_NOINTERFACE seems not to make any sense. If the search of the IID in the registry however there is no proxy/stub registered; I'd guess that's the reason.
Steve
|
|
|
|
|
The default value of [HKEY_CLASSES_ROOT/Interface/{3050F429-98B5-11CF-BB82-00AA00BDCE0B}/ProxyStubClsid32] is {B8DA6310-E19B-11D0-933C-00A0C90DCAA9}.
{B8DA6310-E19B-11D0-933C-00A0C90DCAA9} is the class id of actxprxy.dll.
I think that actxprxy.dll is the proxy/stub for IElementBehaviorFactory, but I don't know why CoMarshalInterThreadInterfaceInStream call fail for IElementBehaviorFactory.
|
|
|
|
|
jinhaibo wrote: The default value of [HKEY_CLASSES_ROOT/Interface/{3050F429-98B5-11CF-BB82-00AA00BDCE0B}/ProxyStubClsid32] is {B8DA6310-E19B-11D0-933C-00A0C90DCAA9}.
My system doesn't have this key. Yours does?
Steve
|
|
|
|
|
|
The environment is Visual Studio 2005 and my project was created via extensibility -> shared add-in.
How can I debug efficiently?
At present, I have to SETUP the add-in and start outlook manually each time I want to see the differences I have made to the program ...
|
|
|
|
|
A poor man's hack would be to insert __asm int 3 somewhere in the code. That will trigger windows into invoking a debugger. You will get a dialog asking you what to do: debug or quit. Choose debug, and use the running instance of VS.NET to debug. It's not pretty, but it works.
As for starting and quiting outlook: you'll have to learn to live with it. Outlook will lock your add-in dll while it's loaded, making it impossible to link the dll while it's running.
--
Not Y3K Compliant
|
|
|
|
|
Using DebugBreak is the slightly more portable version. It does mean that the debugger stops inside the DebugBreak function rather than in the calling function, so you need to do a Step Out when the debugger stops.
|
|
|
|
|
I am trying to use the settings.designer.cs file for a value that needs to be put into the app.config file.
My config(auto-generated by VS2005) file now looks like this:-
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="Settings1" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</sectionGroup>
</configSections>
<applicationSettings>
<General.Settings1>
<setting name="DatabasePath" serializeAs="String">
<value>C:\Web\App_Data\Messages.mdb;</value>
</setting>
</General.Settings1>
</applicationSettings>
</configuration>
In the C# code i am trying to access this property by this code:
Settings1 set = Settings1.Default;
string str = set.DatabasePath;
return str;
The above line of code returns null.can anyone explain what am i missing here?
|
|
|
|
|
hi Shilpa,
how to access a COM component developed in vc++6.0 from ASP.net?
what r the issues need to be considered in this case??
Thanks in advance.
Prashanth.v
|
|
|
|
|
hi experts,
I'm quite new to the topic of COM and Automation and I have a few basic problems and questions:
I modified my existing MFC application to a multithreaded Automation server with the help of a tutorial i found on http://www.codeproject.com/com/mfc_autom.asp and made it via coinitializeex running as multithreaded, the application is a .exe
and lateron call COleTemplateServer::RegisterAll(),
but when I try to get an active instance via hr=GetActiveObject(clsid) I get as result: 0x800401e3 operation unavailable
and if i try to create a new instance via
hr=::CoCreateInstance(clsid, NULL, CLSCTX_LOCAL_SERVER, IID_IApplication1, (void**)&m_IApplication))
it returns the active instance instead of creating a new one
I also use another project with automation and there getactiveobject and cocreateinstance works fine
I think as COleTemplateServer::RegisterAll() returns TRUE it should correctly register my objects with the ROT (which if not, could be the reason for getactiveobject returning an error) or am I wrong?
So has anyone an idea how I become it working to getactiveobject() returning the active object and cocreateinstance() creating a new one
with best regards Stefan Buchner
|
|
|
|