<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>IBlog &#187; Windows Plateform</title>
	<atom:link href="http://blog.objectpattern.com/category/windows-plateform/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.objectpattern.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Mon, 31 Oct 2011 15:03:11 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Separate domain and Runas</title>
		<link>http://blog.objectpattern.com/networking/separate-domain-and-runas/#utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=separate-domain-and-runas</link>
		<comments>http://blog.objectpattern.com/networking/separate-domain-and-runas/#comments</comments>
		<pubDate>Thu, 02 Jun 2011 08:15:17 +0000</pubDate>
		<dc:creator>Himanshu</dc:creator>
				<category><![CDATA[Networking]]></category>
		<category><![CDATA[Windows Plateform]]></category>

		<guid isPermaLink="false">http://blog.objectpattern.com/?p=106</guid>
		<description><![CDATA[Have you ever wonder how can you run a specific application having awareness of different domain&#8217;s credentials? We have VPN setup between our different offices, and all offices are having complete separate windows domain tree. I&#8217;m in Pune office, that is having domain, which has not direct relation to our US office (e.g. it&#8217;s not [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever wonder how can you run a specific application having awareness of different domain&#8217;s credentials? We have VPN setup between our different offices, and all offices are having complete separate windows domain tree. I&#8217;m in Pune office, that is having domain, which has not direct relation to our US office (e.g. it&#8217;s not welcomed in networking terms) &#8211; and believe me there is a good reason to be it that way.</p>
<p>While being in Pune, I needed to run an application on my machine (that is in Pune domain), with is aware that I also have valid credentials in our US office. And Runas worked well in that case as well. Runas.exe can be found in %WINDIR%\System32, checkout its short help by: %windir%\system32\runas.exe /? on command prompt.</p>
<p>I had used it as %WINDIR%\System32\runas.exe /netonly /user:&lt;my US domain name&gt;\&lt;my username in US domain name&gt; &#8220;&lt;path to the application that should run within that credentials&gt;&#8221;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.objectpattern.com/networking/separate-domain-and-runas/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Upgrading XP by SP3 on Laptop</title>
		<link>http://blog.objectpattern.com/windows-plateform/upgrading-xp-by-sp3-on-laptop/#utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=upgrading-xp-by-sp3-on-laptop</link>
		<comments>http://blog.objectpattern.com/windows-plateform/upgrading-xp-by-sp3-on-laptop/#comments</comments>
		<pubDate>Fri, 21 Jan 2011 14:04:11 +0000</pubDate>
		<dc:creator>Himanshu</dc:creator>
				<category><![CDATA[Windows Plateform]]></category>

		<guid isPermaLink="false">http://blog.objectpattern.com/windows-plateform/upgrading-xp-by-sp3-on-laptop/</guid>
		<description><![CDATA[I was trying to apply Windows XP SP3 through windows auto updates.&#160; Auto update repeatedly reported that it couldn’t apply SP3 update. After digging further, I found that update was failing because laptop was not on AC supply. 
Two points to note:

On laptop, shouldn’t apply windows update while battery powered 
Interesting to understand that either [...]]]></description>
			<content:encoded><![CDATA[<p>I was trying to apply Windows XP SP3 through windows auto updates.&#160; Auto update repeatedly reported that it couldn’t apply SP3 update. After digging further, I found that update was failing because laptop was not on AC supply. </p>
<p>Two points to note:</p>
<ol>
<li>On laptop, shouldn’t apply windows update while battery powered </li>
<li>Interesting to understand that either xp auto update do not have way to report correct problem and instead just say “Could not apply following updates”, or maybe SP3 installer is not rightly coded for auto update. </li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://blog.objectpattern.com/windows-plateform/upgrading-xp-by-sp3-on-laptop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ignorance is not bliss. EventWaitHandle.OpenExisting throws WaitHandleCannotBeOpenedException</title>
		<link>http://blog.objectpattern.com/dot-net/ignorance-is-not-bliss-eventwaithandle-openexisting-throws-waithandlecannotbeopenedexception/#utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=ignorance-is-not-bliss-eventwaithandle-openexisting-throws-waithandlecannotbeopenedexception</link>
		<comments>http://blog.objectpattern.com/dot-net/ignorance-is-not-bliss-eventwaithandle-openexisting-throws-waithandlecannotbeopenedexception/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 06:36:25 +0000</pubDate>
		<dc:creator>Himanshu</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Windows Plateform]]></category>

		<guid isPermaLink="false">http://blog.objectpattern.com/uncategorized/ignorance-is-not-bliss-eventwaithandle-openexisting-throws-waithandlecannotbeopenedexception/</guid>
		<description><![CDATA[My development computer got upgraded to Windows 7, Windows 7 is good experience.
For one of our client, I needed to setup mechanics such that admin users should be able to initiate a process in Windows Service using GDI based .NET application. We had also developed the windows service in .NET. As both of them are [...]]]></description>
			<content:encoded><![CDATA[<p>My development computer got upgraded to Windows 7, Windows 7 is good experience.</p>
<p>For one of our client, I needed to setup mechanics such that admin users should be able to initiate a process in Windows Service using GDI based .NET application. We had also developed the windows service in .NET. As both of them are .NET applications, there are more than one ways to IPC between them. As in this case there was only need to give signal to the service, I choose to do it through <a href="http://msdn.microsoft.com/en-us/library/ms686915(VS.85).aspx">Windows Event</a>. .NET BCL provides wrapper around Win32 functions to do this through type named <a href="http://msdn.microsoft.com/en-us/library/system.threading.eventwaithandle.aspx">EventWaitHandle</a>.</p>
<p>I completed the code like I used to do in my old days, and tried the first use of it. On call to OpenExisting, client application failed with exception &#8220;No handle of the given name exists”. My first thought was that this could be because of UAC, but in that case it should say something like access violation. I tried running application in Windows 2003 Server and it worked perfectly. I decided to check documentation.</p>
<p>After some time I landed to <a href="http://msdn.microsoft.com/en-us/library/aa382954(VS.85).aspx">msdn</a> page for namespaces of kernel objects, which indicates that:</p>
<blockquote><p><em>For processes started under a client session, the system uses the session namespace by default. However, these processes can use the global namespace by prepending the &#8220;Global\&#8221; prefix to the object name</em></p></blockquote>
<p>changed my client code to have name prefixed with “Global\”, and everything started behaving the way I wanted it to in Windows 7 as well.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.objectpattern.com/dot-net/ignorance-is-not-bliss-eventwaithandle-openexisting-throws-waithandlecannotbeopenedexception/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Knowing memory usage from Compact Framework application</title>
		<link>http://blog.objectpattern.com/compact-framework/knowing-memory-usage-from-compact-framework-application/#utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=knowing-memory-usage-from-compact-framework-application</link>
		<comments>http://blog.objectpattern.com/compact-framework/knowing-memory-usage-from-compact-framework-application/#comments</comments>
		<pubDate>Sat, 10 Jan 2009 18:50:38 +0000</pubDate>
		<dc:creator>Himanshu</dc:creator>
				<category><![CDATA[Compact Framework]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Windows Plateform]]></category>

		<guid isPermaLink="false">/post/Knowing-memory-usage-from-Compact-Framework-application.aspx</guid>
		<description><![CDATA[For any handheld device application, memory usage is an important element to observer. .NET Compact framework have very less code that gives information about physical or virtual memory. But using native libraries &#8211; by doing pInvoke, one can retrieve memory usage statistics.
There can be more than one level of report that can be captured. Today, [...]]]></description>
			<content:encoded><![CDATA[<p>For any handheld device application, memory usage is an important element to observer. .NET Compact framework have very less code that gives information about physical or virtual memory. But using native libraries &#8211; by doing pInvoke, one can retrieve memory usage statistics.</p>
<p>There can be more than one level of report that can be captured. Today, lets start with summary. GlobalMemoryStatus function in coredll can help identifying how much total physical memory available in the device and how much of it is free. Same way, how much of virtual memory available to process and how much of it is free.</p>
<p>Lets see how can we use GlobalMemoryStatus. We will have to define a class which will be passed to function and will be filled by GlobalMemoryStatus function. Layout of it is defined as structure by MS team, but its alright to use class here. By having it as class, we will be able to write default constructor unlike structure in C#.</p>
<pre class="csharpcode">    [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
    <span class="kwrd">internal</span> <span class="kwrd">class</span> MemoryStatus
    {
        <span class="kwrd">public</span> <span class="kwrd">uint</span> dwLength;
        <span class="kwrd">public</span> <span class="kwrd">uint</span> dwMemoryLoad;
        <span class="kwrd">public</span> <span class="kwrd">uint</span> ullTotalPhys;
        <span class="kwrd">public</span> <span class="kwrd">uint</span> ullAvailPhys;
        <span class="kwrd">public</span> <span class="kwrd">uint</span> ullTotalPageFile;
        <span class="kwrd">public</span> <span class="kwrd">uint</span> ullAvailPageFile;
        <span class="kwrd">public</span> <span class="kwrd">uint</span> ullTotalVirtual;
        <span class="kwrd">public</span> <span class="kwrd">uint</span> ullAvailVirtual;
        <span class="kwrd">public</span> <span class="kwrd">uint</span> ullAvailExtendedVirtual;
        <span class="kwrd">public</span> MemoryStatus()
        {
            <span class="kwrd">this</span>.dwLength = (<span class="kwrd">uint</span>)Marshal.SizeOf(<span class="kwrd">typeof</span>(MemoryStatus));
        }
    }
</pre>
<style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
<p>Now, lets define extern method for GlobalMemoryStatus</p>
<pre class="csharpcode">        [<span class="kwrd">return</span>: MarshalAs(UnmanagedType.Bool)]
        [DllImport(<span class="str">"coredll.dll"</span>, CharSet = CharSet.Auto, SetLastError = <span class="kwrd">true</span>, EntryPoint = <span class="str">"GlobalMemoryStatus"</span>)]
        <span class="kwrd">static</span> <span class="kwrd">extern</span> <span class="kwrd">bool</span> GlobalMemoryStatusWinCE([In, Out] MemoryStatus lpBuffer);
</pre>
<p>And here is how we can call the method</p>
<pre class="csharpcode">    MemoryStatus internalReport = <span class="kwrd">new</span> MemoryStatus();
    <span class="kwrd">if</span> (GlobalMemoryStatusWinCE(internalReport))</pre>
<pre class="csharpcode">
]]></content:encoded>
			<wfw:commentRss>http://blog.objectpattern.com/compact-framework/knowing-memory-usage-from-compact-framework-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

