Copyrights @ Journal 2014 - Designed By Templateism - SEO Plugin by MyBloggerLab

Showing posts with label Windows. Show all posts
Showing posts with label Windows. Show all posts

Wednesday, January 21, 2009

Add Command prompt to explorer context menu

Its been always a long process to reach to desired folder using "cd" command on Command Prompt. It was easier to have a context menu for any folder in Windows Explorer as "Start command here". I had been using it for such a long time, so don't know who told me how to do this, but recently a friend asked me so thought it is easier to post a blog and point him to the post.

  1. Open Windows explorer

    image 

  2. Go to Tools menu -> Folder Options -> File Types. You can probably reach this place via control panel also.

    image
  3. Select "Folder" remember not to select "File Folder" and click on "Advanced". I already have created "command" as my context menu so you will see that here too.

    image
  4. Click New and put Action as "Start command here" and Application used as absolute path to cmd.exe usually it is in your system32 directory.

    image
  5. Click "Ok" and then "Close" to get back to Windows Explorer.
  6. Right click on any folder in Windows Explorer to see the context menu added.

Good luck!!

Monday, May 07, 2007

Windows zip folder association

Windows has built in zip files added as folders in Windows Explorer. This feature is default support by a Windows standard install. This makes it completely difficult when there are more than on file in the folder or even if there is only one large file with a lot of files and folders inside it.

 

Here is the solution, run following on Windows /DOS command prompt.

 

"regsvr31 /u zipfldr"
(offcourse with out quotes)

If you want to register it back then

"regsvr31 zipfldr"
(offcourse with out quotes)

Chow!!

Thursday, August 24, 2006

Python on the .NET Framework

One of the least talked language on web is IronPython when it became available in Microsoft CLR.
Dynamic runtime languages were previously thought to run very poorly on the .NET Framework, but IronPython dismisses that idea. Microsoft is backing IronPython because it exemplifies just how well the .NET Framework can handle dynamic runtime languages. Supposedly, IronPython runs as fast as the C-based implementation of Python-2.4, if not faster. The company claims that IronPython can run 1.8x faster than Python-2.4 right now. Besides being speedy, it also allows developers to access all of the standard C Python libraries, not to mention and create their own subclasses deriving from the .NET framework.
IronPython is the codename for a new implementation of the Python programming language on the .NET Framework. It is fast - up to 1.8x faster than Python-2.4 on the standard pystone benchmark. It supports an interactive interpreter with fully dynamic compilation as well as static compilation to produce pre-compiled executables. It's well integrated with the rest of the Framework and makes all of the .NET libraries easily available to Python programmers. In this episode Jim Hugunin introduces IronPython with demos showing interactive exploration and GUI building from a command prompt as well as simple embedding as a scripting language in an existing Windows Presentation Foundation application. Via Overview at Microsft's Download website
Still, when I read this old news, I was surprised to see Microsoft's backing on Python where they will not be investing that much of money to see a dynamic language work. Anyways, as part of research found a very interesting comparision of Ruby, Java and C++ with Python by dmh2000. This comparision is just awesome.
conclusion
Java is more productive than C/C++. Use C/C++ only when speed or bare metal access is called for. Python/Ruby is more productive than Java and more pleasant to code in. There is a big question on static vs. dynamic typing. I contend that static typing has to be better for the purposes of program correctness, but the required cruft reduces productivity. If actual practice in large systems shows that in fact runtime typing errors don't occur often and are worth the productivity tradeoff, then I will bow to dynamic typing. I can't come up with a definitive answer to Python vs. Ruby. They seem very equivalent. Would choose based on practicality in a given situation. My general feeling was that Python annoyed me in ways that Ruby didn't, but I think those annoyances would disappear if I was using Python all the time.

Tuesday, August 22, 2006

Create a Thumbnail Image of web page

How do I create cached image of a webpage. I just wanted to create a thumbnail of a webpage based on URL. There is no way, you would find the right stuff to do so. I found Alan Dean's page on Generate an image of a web page. He has explained the technique very well. Described his search for such code. He wrote on his own. There are a very few people got it working. So here is the code, took me a lot of time to get it working. Read through the sample I added here very carefully before you copy the code as is. I tried my best to write all comments to make it easy readable.
Tried it in all possible ways to make it successful the way I wanted. This code works awesome but I wanted to use System.drawing very well to make it work. There is no way I could find to do this without using Win32 Api. Apart from that, I need to add the axWebBrowser control and it needs to be visible on form in order to find the image of the web page. Then how do I do it on the fly on my website. There must be a way to create a thumbnail from webpage with out adding ActiveX controls....
Good Luck!! Let me know if this works for you.
'*************************************************************************
'This is main form Class where you will add the basic functions.
'*************************************************************************


Imports
SHDocVw ' Import the shdocvw.dll from Widnows\System32 folder.
Imports mshtml  ' Import the mshtml.dll from Widnows\System32 folder.
Imports System.Runtime.InteropServices ' Need this as we added above two as Interop

Imports
System.Windows.Forms

Public
Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        'Add the axWebBrowser control from SHDocVw library to your form name it as axWebBrowser
        'Add the Event Handler as DocumentComplete, because we need to capture screen image when document is completely loaded.
        AddHandler axWebBrowser.DocumentComplete, AddressOf Me.OnDocumentComplete
        End Sub
      Private Sub OnDocumentComplete(ByVal sender As Object, ByVal e As AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent)
 
        Dim document As IHTMLDocument2 = CType(Me.axWebBrowser.Document, IHTMLDocument2)
        If Not (document Is Nothing) Then
            Dim element As IHTMLElement = CType(document.body, IHTMLElement)
            If Not (element Is Nothing) Then
                Dim render As IHTMLElementRender = CType(element, IHTMLElementRender)
                If Not (render Is Nothing) Then
                    ' Using
                    Dim graphics As Graphics = Me.pictureBox.CreateGraphics
                    Try
                        Dim hdcDestination As IntPtr = graphics.GetHdc
                        render.DrawToDC(hdcDestination)
                        Dim hdcMemory As IntPtr = gdi32.CreateCompatibleDC(hdcDestination)
                        Dim bitmap As IntPtr = gdi32.CreateCompatibleBitmap(hdcDestination, Me.axWebBrowser.ClientRectangle.Width, Me.axWebBrowser.ClientRectangle.Height)
                        If Not (bitmap = IntPtr.Zero) Then
                            Dim hOld As IntPtr = CType(gdi32.SelectObject(hdcMemory, bitmap), IntPtr)
                            gdi32.BitBlt(hdcMemory, 0, 0, Me.axWebBrowser.ClientRectangle.Width, Me.axWebBrowser.ClientRectangle.Height, hdcDestination, 0, 0, CType(gdi32.TernaryRasterOperations.SRCCOPY, Integer))
                            gdi32.SelectObject(hdcMemory, hOld)
                            gdi32.DeleteDC(hdcMemory)
                            graphics.ReleaseHdc(hdcDestination)

                            'Add a PictureBox control to your form, named pictureBox. This way you can
                            'see the image immediately after it is generated. You can save to FS using Bitmap.Save method.
                            Me.pictureBox.Image = Image.FromHbitmap(bitmap)

                        End If

                    Finally

                        'You must dispose Graphics Object for better use.
                        CType(graphics, IDisposable).Dispose()
                    End Try
                End If
            End If
        End If
    End Sub
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        ' Add a button to you form named Button1.
        ' This way we can control when we want to start Browsing.
        ' Select the URI to be browsed here.
        Me.axWebBrowser.Navigate(New Uri("http://www.google.com"))
 
    End Sub
End Class
'*************************************************************************
'This class for dummy for calling GDI Functions from Win32 Api.
'So that you can encapsulate whole GDI work outside.
'*************************************************************************
Public Class gdi32

    ' I copied all the signatures in this class from http://www.pinvoke.net 
 
    Public Declare Function DeleteDC Lib "gdi32.dll" (ByVal hdc As IntPtr) As Boolean
    Public Declare Function SelectObject Lib "gdi32.dll" (ByVal hdc As IntPtr, ByVal hgdiobj As IntPtr) As IntPtr
    Public Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hDC As IntPtr) As IntPtr
    Public Declare Function CreateCompatibleBitmap Lib "gdi32" (ByVal hDC As IntPtr, ByVal nWidth As Integer, ByVal nHeight As Integer) As IntPtr
    Public Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As IntPtr, ByVal x As Integer, ByVal y As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer, ByVal hSrcDC As IntPtr, ByVal xSrc As Integer, ByVal ySrc As Integer, ByVal dwRop As Integer) As Integer
    Enum TernaryRasterOperations As Integer
 
        SRCCOPY = 13369376      'dest = source
        SRCPAINT = 15597702     'dest = source OR dest
        SRCAND = 8913094        'dest = source AND dest
        SRCINVERT = 6684742     'dest = source XOR dest
        SRCERASE = 4457256      'dest = source AND (NOT dest )
        NOTSRCCOPY = 3342344    'dest = (NOT source)
        NOTSRCERASE = 1114278   'dest = (NOT src) AND (NOT dest)
        MERGECOPY = 12583114    'dest = (source AND pattern)
        MERGEPAINT = 12255782   'dest = (NOT source) OR dest
        PATCOPY = 15728673      'dest = pattern
        PATPAINT = 16452105     'dest = DPSnoo
        PATINVERT = 5898313     'dest = pattern XOR dest
        DSTINVERT = 5570569     'dest = (NOT dest)
        BLACKNESS = 66          'dest = BLACK
        WHITENESS = 16711778    'dest = WHITE
    End Enum
End Class

'Check out Alan Dean's explaination, because I don;t get it. He is smarter than me, so I just believed that it works.
<Guid("3050f669-98b5-11cf-bb82-00aa00bdce0b"), System.Runtime.InteropServices.InterfaceTypeAttribute(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIUnknown), System.Runtime.InteropServices.ComVisible(True), System.Runtime.InteropServices.ComImport()> _
Interface IHTMLElementRender
    Sub DrawToDC(<System.Runtime.InteropServices.In()> ByVal hDC As IntPtr)
    Sub SetDocumentPrinter(<System.Runtime.InteropServices.In(), System.Runtime.InteropServices.MarshalAs(UnmanagedType.BStr)> ByVal bstrPrinterName As String, <System.Runtime.InteropServices.In()> ByVal hDC As IntPtr)
End Interface
 
 
 

Thursday, July 27, 2006

Competition - MSN - Google - We sing Kajara re


About 8 months back I uploaded whole Diwali Party on Google video. Thought it was awesome. Then here it is MSN Video a product of competition. I am so happy to see this. This competition has given us Windows Live, a next generation of web accessories from MS. Though these Live tools are a long way from beating Google's Froogle, Spreadsheet, Notebook, Reader. Both of these competitors are more or less in BETA mode, but their products are very usable. I personally use them. Yahoo!! is also not away from competition, try Yahoo's Farechase. I really dont care who wins, I know, whoever wins will be the best product. There is so much of population, so nobody will be out of business, unless they are bought by other.
Try out the new Notebook from Google. I requested Google to provide RSS feed for the Public notebooks. Then I can read other feeds and make notes on MSN Live pages or Google Reader. This competition has also given us the 2 GB Email space. Gmail started this trend and now anyone who is less than 2 GB is out of business. Gmail provides an edge over as it is ever growing space. MSN Live Beta has also started a trial for Hotmail with 2 GB. You have to sign up for that.
The best thing out of competition is handshake betweeen Yahoo Messager and MSN Messenger. The Windows Live Messager Beta can talk to Yahoo Messenger with Voice and vice versa. Read this MS Note and Yahoo Note. In Hindi, "Dushman ka dushman, dost hota hai!!", means "Enemy's enemy becomes your friend". Bottom line, this competition is giving us great tools online, some slick web programming from giants. We all sing "Kajara re!!".

Monday, July 11, 2005

scanf : 'floating point formats not linked'

Have you seen this error in your C or C++ programs, the programs are very simple,
float myFloat; scanf("%f",&myFloat); /* This step results in abnormal termination or program with an error as scanf : floating point formats not linked. */
This can be seen at runtime, when the line is called during execution, there is a great chance based on platform and compiler, you will see this error. I discovered this during development of linked list program which would have some float manipulation. After a considerable research I realised that, it can happen when I am using the Borland C++ or Turbo C as compiler.
"Floating point formats not linked" is a Borland run-time error (Borland C or C++, Turbo C or C++). Borland's compilers try to be smart and not link in the floating- point (f-p) library unless you need it. Alas, they all get the decision wrong. One common case is where you don't call any f-p functions, but you have %f or other f-p formats in scanf() or printf() calls. The cure is to call an f-p function, or at least force one to be present in the link.
- via Jeffc.com
"jeffc.com" also talks about solution, and it works as follws.
To do that, define this function somewhere in a source file but don't call it: static void forcefloat(float *p) { float f = *p; forcefloat(&f); }
It doesn't have to be in the module with the main program, as long as it's in a module that will be included in the link. If you have Borland C++ 3.0, the README file documents a slightly less ugly work-around. Insert these statements in your program: extern unsigned _floatconvert; #pragma extref _floatconvert
This also means that you might not see this on some platforms like linux, and AIX versions. I could not replicate that on any other platform than Windows.

Monday, March 01, 2004

Look@Microsoft Shared Source Initiative
Microsoft after a long time of legal battles, is releasing Windows source code to customers, Goverments and partners and also to developers. Off course one needs to accept the Shared Source Licensing Terms from Microsoft. There are several modles are opened up for making this a success. That definitely means the source code is not for everybody.
Through the Shared Source Initiative, Microsoft advances several important objectives:
  • Bolster the freedom and success of customers, partners, researchers, and developers by affording them expanded access to source code.
  • Enable Windows users to ensure the integrity and security of their computing environments.
  • Enrich the development community by providing the tools to produce outstanding software.
  • Improve feedback processes that play a critical role in developing better Microsoft products for business and individual consumers of software.
  • Enhance educational opportunities and to cultivate a vigorous software industry of the future by placing technology in the hands of universities throughout the world.
  • Preserve the intellectual property rights that historically have fostered unparalleled innovation and growth in the global software industry.
You can actually get the Windows source code under the enterprise licensing, Windows CE source code, Smart Devices Developer samples, C#/JScript/CLI Implemetation all for free of cost. I really didn't believe that unless I downloaded the Windows CE source code.

Friday, February 27, 2004

Analysing Windows Hang or Crash Dumps

Analyzing Windows Hang Dumps
All we know is how to analysing the Windows Dumps, they provide all valuable information about how to analyse, what happened in Windows memory that moment. This gives out all the information we need for finding out the cause behind the problems.
Once those dumps are made you can analyze all the threads and also the objects running in memory. You can grab along the hang dump, the application dlls loaded in memory.

There is a lot of interesting information all over internet. Most of them talk about working with old VS 6 version of MS code. There are hardly any websites which talk about the .NET CLR debugging except
"Production Debugging for .NET Framework Applications "
"SOS Debugging of the CLR, Part 1"
They are the ones who talk about the debugging, the first one is way more deep.


Get the Debug Tools for Windows, just download and install.
Most important thing in analysing those is to get the symbols. Symbols for you application files is easiest to get. Otherwise you have to search on Microsoft site for the CLR symbols. There is facility by which you can set up an environmental path "_NT_SYMBOL_PATH", set it to value like "SRV*c:\symbols\web*http://msdl.Microsoft.com/download/symbols; c:\symbols\app;c:\symbols\os;C:\SYMBOLS\SOS". This is the first thing you want to do. It has few more details involved.

"SRV*c:\symbols\web*http://msdl.microsoft.com/download/symbols" - Tell WinDBG to download the Operating system symbols to download, and where to download and from where.

You can download the symbols on you own and keep it on hard drive, they are available at DDK website of Microsoft. Beware to download the symbols you want. Gather the symbols for your application too.

Then most important thing you want to do it to get then is .NET CLR symbols. We need those if you have to get the .NET stuff debugged properly. There are symbols for the MSCORSVR.dll and MSCORWKS.dll. They form the major part of the .NET framework. These dlls are the available from Microsoft here. They attach the standard 1.0 dlls. I am not sure how you get those, symbol files for 1.1. I didn't get them at all. If somebody knows please let me know more about them. You would be surprised they are for the Framework versions as 1.0.3705. 0, 1.0.3705. 209, 1.0.3705.288 and 1.3705.0.352 only. The documentation for SOS usage is available in Framework SDK 1.1 at path "SDK\v1.1\Tool Developers Guide\Samples\sos". You can get the code also for the same from SSLI, download here.
Note that the base version is for 1.0.3705.0 , then the service packs or hot fixes change the version of the framework, though they all are under the 1.0 framework. There is a KB article on MS TechNet which describes how to determine the version of framework you are running. I would suggest not to use that as it just looks for the version of MSCORCFG.dll and NOT MSCORLIB.dll, MSCORSVR.dll and MSCORWKS.dll. The other three assmblies actually form the basic framework. The service packs or the other hot fixes upgrade the version of these dlls but the MSCORCFG.dll remains at base version. So it is kind of unreliable. So I just checked the version of those dlls to confirm. If you have other versions than those, god help you I could not find the BIN files for those.
Then you have to load the psscor.dll and then make a command as !findtable provide it path for you .Net SOS symbol BIN files (C:\symbols\sos may be). If this runs good, you have all setup for running the debug mode. The psscor.dll is only for asp_wp process. You might need to find more for all other if you are using something else.

There is set of command you can use for accessing and then finding out more about the WinDbg tool. Run the command as !help on command prompt in the WinDbg you should be able to get all te SOS commands list. I really wanted to publish the list of commands but still I have digged into them that hard. Just learning!!!

The !dumpMT and !dumpModule allow more insight on the Method table and also the modules loaded in the memory. There is still lot to be found in great details. There are some basic commands for the finding out more about the threads and thread pools, they not exactly for managed code.

I need to read more on the managed thread pools. They also provide valuable information on the memory dump analysis. The '!dumpallexceptions' command after loading the psscor, will dump all the unique exceptions in the memory. This will also list the count of the exceptions listed. The '!thread' command provides the context, state, exception, GC, domain and thread locks. The 'Production Debugging' article link in the top has a whole section written for how to set the breakpoints and deep debugging techniques for the thread contention problems.


Note: Update 01/30/2006 If you are debugging, .Net Framework 2.0 or 1.1.4322, use the SOS.dll from the one provided with framework. For more information you can check this site.

Monday, October 20, 2003

Debugging Windows Services using Microsoft Visual Studio .NET

Everybody working on MS platform understand what pain was it to write the Windows services before .NET platform. Though .NET takes care a lot of things on Windows Services development, we do not have sufficient power of debugging enhanced. I wanted to have some methods to do the same. Here is the jist of what I found, though it looks a kind of scattered but that is it and is much better than I found it.

Method 1 : The this one really speaks about debugging them in-proc using a work around of Dummy Service. "Attaching to the service's process allows you to debug most but not all of the service's code; for example, because the service has already been started, you cannot debug the code in the service's OnStart method this way, or the code in the Main method that is used to load the service. One way to work around this is to create a temporary second service in your service application that exists only to aid in debugging. You can install both services, and then start this "dummy" service to load the service process. Once the temporary service has started the process, you can then use the Debug menu in Visual Studio .NET to attach to the service process."
Sometimes it does not make any sense to have some more code written just to debug some code. This is bit useful and a sure method of testing that the debugging works.

Method 2 : This one allows you to debug the OnStart using the some different line of code and explicitly calling the OnStart Method, which I used to debug.
Writing a small main routine and then working it out, makes sense but in this case the service does not remain a service, when I tried to work this out, I could debug the service but it lost the track of VSS attached with this. Shashi says this might be because of adding the main routine in the program it changed the type of the project and then it lost the track of VSS. Doesn't this mean my project is wasted now. Remember after you remove the main routine back to the original, does not mean the project type is changed back to OS service again.

Method 3:This one is for the reference, I could start the debugger as specified by the article, instead of MSVC, I added the fully qualified DEVENV.exe. This opens a new Solution for debugging offcourse it does not have any code in that to put the break points and to step-in. It even overrides the 30 second limit of service startup. MSDN does not speak how to attach an existing solution/Project to this solution, or opening an existing solution to debug. How can I attach the PDB file or the solution so that I can debug the same? This is a valid request for all of the world of developers (should I say debuggers?).

Sunday, September 28, 2003

Using Group Policies in Windows XP
In Windows XP professional check out this following procedure to see the what you can on the local machine.
To set Terminal Services policies settings for a particular computer or for users of that computer, open the Group Policy snap-in to edit the Local Group Policy snap-in.
The Terminal Services group policies are not configured by default. You can configure each Group Policy to be either disabled or enabled.
  • From the Start menu, click Run, type mmc, and then click OK.
  • On the File menu, click Add/Remove Snap-in.
  • In the Add/Remove Snap-in dialog box, click Add.
  • In the Add Standalone Snap-in dialog box, click Group Policy, click Add, and then click Finish.
  • In the Add Standalone Snap-in dialog box, click Close.
  • In the Add/Remove Snap-in dialog box, click OK.
  • In the console pane, you can see total new world of settinsgs you can make for the administration on the workstation, I am damn sure these settings can be done using the scripting or registry changes. But not necessary you have to use the scripts for all the purpose. I kinda liked this user interface. For somebody who want to check what happened when he executed the script. Here is the cool interface.

    I searched it when I had about 100 servers to remember so wanted to device a list of all RD Connections in my single console for the mmc where I control all the snap ins like MQ, IIS, Computer management, .Net Framework configuration and Biztalk server. Still searching for it.

    Using this Group Policy snap-in, you can change and configure the settings of all the components at computer level or at user level for Internet Explorer, Network settings, Software restrictions, Windows Components, desktop control panel. It is really cool to have everythign setup in a single screen.
  • Saturday, September 27, 2003

    Compare Microsoft Programmming Languages
    In the development, more important is to choose a language. In Microsoft .NEt technologies, it really does not matter, the laguage you are programming. Still there some features and briliances of individual languages. Visual C#.NET and VC++.Net have pointers where as the VB.NET does not.

    We're always going to have a half a million or 50 million religious VB programmers. But guess what? We have VB in .NET. And now we have Java language in .NET. We've even got COBOL!" – Tim Huckaby, President and CEO, Interknowlogy

    Programming languages are an inherently personal choice, one based on a number of factors. Rather than force programmers to adopt one language over another, Microsoft provides a platform on which a number of languages—C++, Objective-C, Fortran, COBOL, Visual Basic®, Perl—can each flourish and enjoy full access to the power and flexibility of the .NET Framework.

    For its part, Microsoft offers four programming languages and associated development environments, each designed to appeal to a particular school of programmer:

    Visual Basic .NET, the latest version of the world's most popular development tool and language. Visual Basic .NET delivers unsurpassed productivity and unique language features for task-oriented developers building solutions with the .NET Framework.

    Visual C++® .NET, the tool of maximum power and control. With the C++ language, power-oriented developers can bridge platform technologies and build both native Windows-based and .NET-connected solutions with maximum performance characteristics and enhanced functionality.

    Visual C#® .NET, the modern and innovative programming language and tool. Introduced in 2001, C# offers a familiar syntax, that is attractive to C++ and Java developers, along with unique language constructs that offer code-focused developers a more elegant experience when developing applications for the .NET Framework.

    Visual J#® .NET, the Java-language tool for Microsoft .NET. Visual J# .NET gives Java-language and existing Visual J++ developers complete access to the .NET Framework and the industry's most advanced XML Web services platform, while maintaining a familiar language and syntax.

    Tuesday, September 16, 2003

    Microsoft VirtualPC
    Microsoft VirtualPC is going to be one of the very revolutionary and powerful software virtualization. This can allow you to run mulitiple operating systems on ONE box. This VPC baught by MSFT from Connectix, the concept is being enhanced by MS and will eb available for all during fall this year.
    I had a chance to install it on my machine and run a couple of images around like Windows Server 2003 with BTS 2004 and also Winodws XP Pro. Could not add that to my office domain due to secrity reason but we can create the netted IP addresses with Virtual Switch for the same. Then you have a network running on your machine. All of the images running on your machien will have same IP Address so it is really confusing but they work well with the DNS names. Even they allow the connectivity on all ports like 139 means I could map the drive to host machine.
    The major one I faced in the BIOS for the images, is that the ACPI aware OS option. Yopu have to set this to "YES", trying to figure out why?
    What is ACPI?
    Newer computers feature ACPI (Advanced Configuration and Power Interface), which extends the APM concept to enable the OS to selectively control power. ACPI supports a variety of power states. Each state represents a different level of power, from fully powered up to completely powered down, with partial levels of power in each intermediate state. Power states include:
    Power State Description
    S0 - On and fully operational
    S1 - System is in low power mode (sleep mode). The CPU clock is stopped, but RAM is powered on and being refreshed.
    S2 - Similar to S1, but power is removed from the CPU.
    S3 - Suspend to RAM (standby mode). Most components are shutdown. RAM remains operational.
    S4 - Suspend to disk (hibernate mode). The memory contents are swapped to the disk drive and then reloaded into RAM when the system is awakened.
    S5 Power off

    Some newer ACPI aware operating systems, such as Microsoft Windows* 98 SE, Windows Me, Windows 2000 and Windows XP*, only support remote wake-up from standby or hibernate mode (S3 and S4). Remote wake can be initiated by a variety of user selectable packet types and is not limited to the Magic Packet format. For more information about supported packet types, see the operating system settings section.
    I will write more when I will find more. But seems like to have the operating system images run better we have to say "YES" in the settings.

    Tuesday, July 01, 2003

    Simplifying Development with DDK Macros
    [via OSROnline] by Don Burn
    Don starts with the basic idea of a macro in my beloved "C". The whole concepts starts and ends in different macros used all ove Windows Device Driver Development. Check out this article. He does speak about NT_STATUS, data alignment, constant strings, parameter macros and compile time asserts statements. It is not exhaustive enough to get the concept but definitely good to start believing in macros.
    Windows Driver Framework Chat
    The idea of Driver Framework, is to provide a best platform unified source for driver development on Windows Platform. Check out the transcripts of the chat on the same. They have tried to answer all possible questions and then we get totally a new idea for the driver development.

    Sunday, June 22, 2003

    Can you really port a Windows device driver to Linux?
    Actually "NO", but just during the search found a very good article on this issue. What really matters when you are a hardware manufacturer or developer. Whether the term "port" is appropriate depends on how much of the device driver code is Windows-specific. If most of the code is concerned with controlling the device, then it seems reasonable to call it "porting". If most of the code is concerned with the Windows API, then it would be more appropriate to call it "re-writing". Whatever you call it, being able to refer to the source code of a working Windows driver can help us with the implementation of a Linux driver - particularly by alerting to us to potential problems in the hardware interface that may not be immediately apparent from the hardware documentation.
    It may also be case changing the way we write drivers to eliminate the Widows specific code or by modulating it in the functions so that it becomes easy to replace. The first option is always bad because it may get into performance related issues over the time and would require a lot of testing for a small small functions. [via : WingPath Software]

    Thursday, June 19, 2003

    Driver for Toshiba Bluetooth PC Card
    About 7 months back, I baught a Bluetooth PCMCIA Card Toshiba PA3053U - Bluetooth CardToshiba PA3053U, but unfortunately they provide CD for Windows 2000. After a lot of research I made for the drier, I could not find the drivers. then decided for the support from Toshiba for the drivers. Being a Compaq, Sony customer earlier, I couldn't wait for more than 20 minutes on phone for the CSR, I decided to throw the card and buy a new one. Fade up with all these things, I was doing something on google search, and found a link where ZDNet published a review for the same card, delightedly I read the article and the last link was for the manufacturer and it came out to be Toshiba, Australia where they have the driver for Toshiba PC Card on Windows XP platform.
    Finally, I am using my Compaq iPaq Pocket PC in "Sync" with my laptop over Bluetooth Tooth. Overall summary is thanks to ZDNet and Toshiba is horrible in support. Their sites are not linked worldwide.

    Friday, May 09, 2003

    Bill Gates Unveils Next Wave of Windows PC Innovation
    NEW ORLEANS -- May 6, 2003 -- Bill Gates, chairman and chief software architect at Microsoft Corp., today unveiled a new PC prototype designed to enhance today's computing experience and usher in the next wave of innovation for the PC industry during his opening keynote at the 12th annual Windows� Hardware Engineering Conference (WinHEC). Gates showed the new PC prototype as just one example of the type of innovation required to address the needs of users -- innovation that is only possible when hardware and software are developed together. Co-developed with HP and code-named "Athens," the advanced PC prototype represents an evolution of the PC as a center for communication and collaboration, one that simultaneously simplifies PC operations while merging all forms of communication -- including next-generation voice, video and text messaging -- into a consistent, streamlined design.

    Tuesday, March 18, 2003

    "Driver Protection List for Windows XP and Windows .NET Server"
    Windows XP Home and Pro versions along with the .NET Server family of Microsoft have a continuously active feature of the Driver Protection List on machine. They stop the unnecessary drivers from loading to the syatem which are known for system instability. The list is always active in the memory all the time, during the upgrade of the platform and runtime. It is something which is discouraged to be disabled. I am not sure but Microsoft says, it is based on the same way the Compatibility of applications is build in Windows XP Editions.
    The Driver Protection module of XP is called whenever the request for the driver comes to the system, the CreateObject(PDRIVER_OBJECT) call. The system checks the driver protection list, an encrypted database within the "Mysterious" operating system, and then allows to load the same. The Driver Protection List, the same said databse is updated by consultation with the vendors and Microsoft. This database is supposed to be updated frequently by the Dynamic and Critical System Updates, a feature of XP. (Another reason to keep the windows update service running). Waiting to see how the list looks like and must be available on http://www.microsoft.com/hwdev/ in future for download.
    This driver protection is last one to solve the errant drivers, can be considered as the low level kernel feature. Microsoft says, this feature will stop the drivers from loading, but the will nto be able to stop the applications from loading, this will give us the error I guess as the "Windows Protection Fault".
    Every time, the end user gets the error for the driver, the error reporting service picks up the data and sends to Microsoft which is used to update the Protection List Database. Most of these drivers, usually available in the Windows Compatibility Database. The error or warning whenever the applications requiring the blocked drivers are loaded/installed, can be from Windows XP Advisor/Setup/Runtime. The matching of driver and the database is based on the sys file of the same, and totally independent of the Hardware ID and any other files used for driver or application. This can be the sys file name, linking date of the file, product version and few more may be, but always more than one criteria is matched before blocking the driver.

    Friday, January 31, 2003

    Device Drivers and Processors
    Windows NT and the XP support multiprocessor architecture. Windows platform holds conditions true as
    1. All CPUs are identical and also they have no or identical co-processor.
    2. All CPUs share memory or have access to the System memory.
    3. Considering the sysmmetric platform, all CPUs take inturrupts, access memory or I/O Control registers.
    Isn't this all good and makes easy for a programmer?
    Windows NT and XP are designed to work on SMP platform. Similar to all other SMP operating systems Windows also take care that the driver sensitive data does not get modified by more than one processor at the same time.
    The Spinlocks I wrote about yesterday, are used to preserve the same. For example, a lowest-level driver's ISR that is handling a device interrupt on one processor must have exclusive access to critical, driver-defined data (or the device registers) in case its device interrupts simultaneously on another processor. Understanding the SMP environment, I/O Requests are completed by one processor and device communications are executed by another processor, in this case, the driver critical data has to be shared with all the driver routines.
    We cannot expect the any locking system without any policies. See what Microsoft says about this
    1 .Only one routine can hold a particular spin lock at any given moment; only the holder of a spin lock can access the data it protects. Another routine must acquire the spin lock in order to access the same data, but the spin lock cannot be acquired until the current holder releases it.
    2. Like a hardware or software interrupt vector, the Kernel assigns each spin lock in the system an associated IRQL value. A kernel-mode routine can acquire a particular spin lock only when the routine is run at the spin lock's assigned IRQL.


    Microsoft does accept the fact that these policies prevent a driver routine that usually runs at a lower IRQL but is currently holding a spin lock from being preempted by a higher priority driver routine that is trying to acquire the same spin lock, thereby causing a deadlock.

    DDK also says
    A lowest-level driver's ISR frequently shares a state area with the driver's DPC routine, which calls a driver-supplied critical-section routine to access the shared area. In this case, the spin lock protecting the shared area has an IRQL equal to the DIRQL at which the device interrupts. While the critical-section routine holds the spin lock and accesses the shared area at DIRQL, the ISR cannot be run in a uniprocessor machine because the device interrupt is masked off, as mentioned in Always Preemptible and Always Interruptible.And in a symmetric multiprocessor machine, the ISR still cannot acquire the spin lock protecting the shared data while the critical-section routine holds the spin lock and accesses the shared data at DIRQL

    Monday, January 27, 2003

    Programming the Microsoft Windows Driver Model, Second Edition
    by Walter Oney.

    Book is released on Dec 16,2002 by Microsoft but still not in market. Just ordered it an waiting for the ReadMe.doc to ship it me. I guess the long list of erratas are reduced. Oney writes very descriptive. The book will be full of diagrams, just waiting for it to be released.
    ** BOOKS **