Archive for the ‘Off Topic’ Category

DriverEntry.com.br shows up

Tuesday, March 4th, 2008

Hi there, I promise to you this post will be pretty short. That news is for the ones who love playing with bits and bytes.

The Forth Programmer’s Meeting, that will be organized by the C/C++ Brazil group, will take place next March 29th.

The event will be counting on a series of lectures with real authorities on the subject. I guess the only distinguished unknown person will be me. I have been invited to talk about driver architecture and development for Windows.

If you have no idea how the drivers are organized and how you can build them, then this is your chance to continue not knowing it, but with a good opportunity to see other excellent talks. I have already given some training, but I cannot say I have had great experiences with lectures. I think the biggest lecture I have ever given was composed by an audience of about three people. That had included my mother, who was telling me all the time to shut up so that she could watch the soap opera.

Anyway, I’ll try to do my best there. Fortunately, my friend Strauss, who incidentally is one of the speakers, has given me a help publishing this post with tips for speakers.

I’ll see you there!

OSR Seminars at Home

Tuesday, January 15th, 2008

If one of the problems that had prevented you from making a specialized training in developing device drivers at the OSR was a fear of flying, so there is no problem anymore. OSR, after years and years of experience teaching how to write drivers, has now invested in Webinars. This news has already been announced since last Jan. 4, but it is still surprising when I comment it with some people. So, I have done this post trying to pass it to more people at once.

 

 

Cheaper?

The financial advantage is in the fact of avoiding buying flying tickets and paying hosting for a week in the United States. Okay, okay, it’s that’s not you who is going to  pay it, but figure out that not everyone works for multi-national companies with thousands of dollars earmarked for employee training. When I had done the training at OSR, everything was paid by the company which I used to work for; however,  if I put everything on the pencil, it was approximately R$ 13,000.oo of investment to attend a seminar of U$ 2,350.00. Taking the current dollar exchange rate, it would be approximately R$ 4,143.00, or roughly, a third of the total. This may simply be the factor that is preventing you from doing the training. So, you can go running to Mommy and Daddy to say them that now they have more purchasing power for your training. But, not three times more. It seems to me Webinars are relatively more expensive than the conventional ones. The seminar I had attended lasted for 32 hours and addressed the File System Driver development (a little advanced subject), while the first webinar offered by OSR will is suppose to do a quick introduction to WDF for 20 hours for the same price.

More Advantages

Another very relevant point is the fact that you don’t need to leave home or the company  that you work for during the seminar. Some people whom I talked to about it told me that a big problem is the fact of leaving home for a week. Some of them have small children or many other reasons you might imagine, but I think the most common reason holding a professional at work is the endless urgent bugs which can only be solved by him. Well, at least this webinar consists of 5 lessons of 4 hours. This allows you to take care of your bug collection while participating into the trainings.

It is not only an expensive PPT

Contrary to what one might figure out, the seminars are going to be interactive using two-way connections where the participant may, in addition to receiving all instructions live, ask questions and even receive all the printed material like in other seminars. The student is going to download the tool that establishes the connection and attend a 15-minute session to test the machine to be used in them and thus, make sure that the participant is having no problem during the training.

And now, if your company really does not want to pay training for you, it is, at least, easier to pay it for yourself; this way you may use this as a new star on your resume.
Goodbye!

The wrist is still pulsing

Friday, January 4th, 2008

Before completing three months without any sign of life, here I am giving a peek at what has happened at the blogosphere. This year ending has been really hectic. As you may know, my employment by IBM has contributed a little to my absence. Okay, the university has also helped a lot. At the very end of the year, I reserved a time for myself and went for a walk on the beach. But let’s stop talking and get to what matters.

In this post, back to the living world, I am going to only comment on small things and postpone for a more elaborated post later (but still in this life), like you’ve been used to seeing around here.

Debug in Free

One of the things I had to learn to live together at IBM was to debug the driver we were supposed to write, which had always been built in Free or with optimizations and everything else that a release building deserved. Well, I have tried reluctantly to say it would be important to have a checked version for testing and that would be valuable to run our driver with all ASSERTs turned on check anything unusual that might occur. But believe me, it is not that easy to convince people that have already being accustomed to this situation. I was looking for good reasons to have a usable checked version when I had found this post. Well, the reasons are actually quite good but I still argue that we should have a checked version . I have been preparing a post that says a little about it.

Talking about knowing English

At some posts before this, I had talked about MSDN translated into some languages, including Portuguese. The message was that we could deal with it a little without knowing English but, if you don’t know English and you want to develop drivers for a living, so you have to learn English as soon as possible. I remembered this post today at a Google search when a link was especially rewarding.

IoGetDeviceObjectPointer Tips

Well, if someone has managed to get some tips, please tell me. If one day I decide to learn a third language, now I have a candidate for it.

New Year, New Look

It was supposed to have happened before, but unfortunately the time is has been short for many people. I put in check brother’s web designer skills. I asked him to improve this blog layout. It’s getting pretty good, but I still have had nothing concrete to be shown. I will be migrating to WordPress soon. Most of the work has already been done but much of it has remained to be done. My main intention in migrating to WordPress is to be able to use one of these plug-ins that would allow me to have the same post in both languages, English and Portuguese. Well, we have tried to test a few of them but they got some problems. But we’ll get there.

CYA…

IBM, Here we go!

Monday, October 15th, 2007

After a few months in a long selection process, I finally can share this good news with you. Good news for me, at least. Today, October 15th, 2007 was my first day as an IBMer on the Tutoia Street building. No, I haven’t given up the Windows Kernel to program neither Java nor ABAP. The issue is the usual one, the same blue screen.

How have you learned that?

This is a question that several people have made me. You may not believe it but it seems that things have naturally contributed to my professional development as a Windows Kernel programmer. When I was an intern at Provectus, I started reading the book “Inside Windows NT” for just a hobby, hopeless of being able one day to work with the things addressed by that literature and after all, having the privilege of working in a hardware development company in Brazil would be like winning the lottery. Well, my internship as a C programmer was in a company that had been developing its own hardware. I was maybe lucky. When it was least expected by me, there I was programming services for Windows NT, using shared memory and even a device driver appeared for my inspection. Because of my previous skill about MFC and Win32 API, what really attracted me was the Kernel Mode development. Once more for hobby, just for pleasure, I started reading about it and I must say it was hopeless again. Yeah, that time the result came from the opposite side. I went to work at a company that used to buy and sell shares for stock exchange. I used to develop COM+ using C++ and just one year was sufficient to learn about ASP, SQL and Java to know that this was not what I had been wanting for me. Luckily, the fate took me to SCUA. I did not know they used to make drivers for Windows. It was during an interview to join to the application team that I found out that there was a drivers’ team. Anyway, guess which team I ended up in after a while? By working there, I got in contact with many professionals, books, discussion lists and especially, the opportunity to put into practice what I had learned in books. Then after, it was the time of  Tempest, and with it, a chance to participate into a File System Driver Training with one of the foremost authorities on the subject. Then, a friend made me an indication for me at IBM, and after two interviews, one at the building and the other on Tutoia Street, I had a technical interview by telephone with the U.S. team; and here I am. I’d work on the MVFS for Windows development team.

And one of the points that had excited me the most in this new venture it was the opportunity to work with highly qualified people on the subject and be able to learn much from a team that involved minimally North Americans, Indians, and that time, one more Brazilian.

My first day at IBM was fulfilled with lectures. Initially, about the IBM history, and the other being about the various procedures that such a big company required.

CYA…

More Contacts

Friday, September 28th, 2007

It has become more frequent, at least for me, the demand for skilled developers in the Windows Kernel. What is frequent for me? Well, besides the companies that I have regularly worked for, which I imagine are already tired of asking me if I know more Kernel programmers, two companies asked me indications just this last month. One of them is the company that is taking one of my friends, Rodrigo Strauss, to Porto Alegre. If you think it is hard to find places for this type of development, it is even harder to find developers for this type of vacancy. Usually when someone asks me for any developer’s indication, I just end up saying that, after more than ten years as a programmer, I can count every kernel developer I have know using just one hand.

The fact is that both are hard to find, so I’m providing a forward invitations and opportunities of Windows Kernel area to this blog readers who are interested in it. Those interested ones should contact me by e-mail so I can expand our network of contacts. Please, try to avoid leaving your e-mail in the post comment area, because in that way, anyone else (including spammers) can see them. If you have not gotten my e-mail yet, just get it from my Blogger profile. Even those who are not interested in new challenges can send me a hello. So that I can know how many of you have already worked with Windows kernel and attempt to start using the fingers of the other hand on that score.

There is an initiative like this is on the OSR Online site where several specialized companies post jobs about Windows Kernel. Maybe in a few hundred years, when my blog is famous worldwide, companies want to publish their vacancies for Brazilian Kernel programmers at DriverEntry.com.br.

For now I just want to know how many and who are the Brazilian Kernel Coders, but I’ll be open to suggestions. Everything is depending on the volume and quantity of responses that I will get during my attempt.

CYA…

But I don’t know English

Thursday, September 27th, 2007

It was through this post that I found out that MSDN beta content (including WDK) is now available for the automatic translation into Portuguese and other languages.

For those who have trouble understanding the original text in English, they can now enjoy the comfort of having the same problems of understanding the same text in Portuguese. This is because the translation is not that good but, it helps for those who have little or no English knowledge.

The result is displayed on the already known MSDN layout, but the main text will come with a split that will separate the Portuguese text from its equivalent English. Maybe it gets better when it stops being beta, but anyway, it remains an alternative for it.

Take a look:
Introdução do kit de drivers do Windows

Automatic translations may be pretty funny. I’ve already seen nasty translations in manuals of imported goods. It’s a shame I have not found that PenDrive manual I have recently bought to share some “pearls” with you!

Device Driver Programming == Motorista de dispositivo programando

Be careful!

My Personal GINA

Wednesday, August 8th, 2007

Due to my returning classes to the university, my time to write posts has now subsided, and once again, you will have to put up a post that says nothing about drivers. In fact, I wrote this GINA sample while I was writing a post about drivers. My friends Slug and Thiago have told me I should just leave this post and write one which could be applied to Windows Vista, since GINAs have not longer been supported on Windows Vista. Then, I have ended up forgetting this code over here. Poor thing… Anyway, as I have thought the result was at least funny, I’ll leave this Stub GINA here (sources included), that allows us to change the title of the dialogs presented.

What is a Stub GINA?

It would be even better to say what a GINA is. I have written a few things about this subject on the post that talks about how to use SoftIce, but in summary, GINA is the system component that implements the Graphical Interface for Network Authentication for users on the computer. Do you still want it more concise? It is the small screen for system logon. GINA is responsible for receiving the data that identifies a user and pass them to the components that can validate their password and generate the token with the user’s credentials. This token is used to create the session that the user is logging in and where your desktop will be created. GINA also implements the interface that makes the password changing, lockout and station shutdown. I will not detail all the steps here: everything is explained at the Platform SDK.

The original Windows GINA is implemented into a DLL named Msgina.dll that is into the System32 directory. To implement a new GINA, you must create a new DLL and “tell” the system that this DLL will be the new GINA via registry key. However, creating a GINA is not that easy as it seems to be. I have developed some of it and let’s say  documentation could be better. GINA has many responsibilities and if you just want to supplement or change any of its default behavior, you should simply create a stub GINA. Stub GINA is a DLL that exports all the functions GINA should do, but it passes the calls to the original system GINA, thus, giving us the option to only change the desired features.

This is not a Tutorial

If you want to learn how to develop a stub GINA and need a starting point, then go to the Platform SDK Samples folder and use the example that can be found at C:\MSSDK\Samples\Security\Gina\GinaStub. The project I’m leaving here performs some juggling to avoid too many repetitive codes and it also does not use the C/C++ Run Time, so that, it can be compiled using Visual Studio 2005 and still be able to run on a Windows NT 4.0.

Installing a GINA

To install a GINA, you must create a value called GinaDLL at the Winlogon registry key, as it is shown below. This value is queried by Winlogon.exe and, if this value does not exist, the default GINA is loaded, though. The GinaTitle value should contain the message that will appear at the dialog titles. Actually, this value has nothing to do with Windows: our stub GINA is the one that reads this value. From the source files, available for download at the end of this post, there is a script file that sets these registry keys to make your life easier.

Make a copy of Gina.dll file to the System32 directory. Make sure that everything is all right before rebooting the machine to make these changes take effect. If something is wrong and Winlogon.exe is not able to load the GINA, the window below appears before anything else.

This MessageBox design has improved greatly from Windows 2000. If the same problem happens on Windows NT 4.0, the following message would be displayed.

Useful tips for GINA coders

Writing GINA is the opportunity for User-Mode developers generating their own blue screens. Your DLL is loaded by Winlogon.exe, and thus, it runs on its process address space. This means that if you have an unhandled exception, this will bring this process down. Winlogon is a critical process and it cannot be overthrown. In short, the blue screen is shown up.

The next tip is kind of silly, but it’s worth being commented. During the process of developing a GINA, it is natural to have multiple builds and you will need to replace the GINA that is being used for the new one. You may have tried to override it, but as always, Winlogon.exe keeps it loaded and you cannot delete the current one. Like any DLL under these conditions, you can rename it while it is being used by a program. This lets you put a new version at the System32 directory without having to delete the one which is currently running. When the system is restarted, Winlogon will pick up the new GINA and drop the old one.

I hope you enjoyed the new toy. Now I need to continue that post.
Have fun!

TitleGina.zip

ExAllocatePool with Tagging

Thursday, July 19th, 2007

My friend Slug was always a great reference on a different way of seeing things. He usually has a different viewpoint from mine, and I have always learned from these other viewpoints. This post will be different than you are accustomed to seeing here. Wanderley had introduced the subject “How to be a better programmer in the next six months” and brought us this new point of view (at least for me) to see blogs, known as Tagging. Here is my reply.

I cannot say that everything will be different in the next six months; I am really going to make every effort to turn a better programmer. I think my answer is similar to the response that Strauss has given us, but not equal.

As some of you know, beyond the work day at Open, I have still faced the university to complete my degree in Computer Engineering. This course has brought me new concepts about micro-processing, embedded systems, computer architecture and other subjects different from Windows programming in C/C++. I can say that it has opened up a little my range of opportunities to learn new things. Developing drivers is, in addition to programming, establishing communication between two near worlds, but virtually unknown to each other. Usually, who knows one of these sides very well, don’t do the same about the other one. It is natural. I have already known a bit of software, and every six months to go, I know some new things about hardware. Knowing better the hardware, I think I can better understand and program the operating system that interacts with it.

Speaking of new things, this month I have found myself buying a book about Device Drivers for Linux. I have been Microsoft ever since. Obviously, I am referring to the professional aspect. My days of MSX and CP200 exert the same influence that my kindergarten does about my resume. The book has not arrived yet, but certainly, it will feed my database about Software/Hardware interaction and it’ll allow me to draw a parallel between these two development platforms, Windows/Linux, and thus, I’ll be able to better understand what they have in common, both concerning Software/Hardware interaction about operating system concepts.

A friend of mine once told me that one of the best ways to learn something is teaching. I have been writing this blog for almost a year and have learned a lot from it. Writing about some things, which would be simple, made me take another view and see that there are still more and more details about it. Thus, I end up learning the details that were lost at first. Some lectures I have given the company and the device driver course work as a Boost for this learning way. I confess I’m enjoying it.

In conclusion and in summary, I will continue studying to get my degree, reading about Linux, continue blogging and being questioned about its issues. This subject is very fun for programmers, but we cannot forget that we are also husbands, sons, brothers, friends and so on. This post can offer you that courage to start studying everything and devote all your time available for the benefit of being the best developer but, cycling and going to the beach are also part of excellent programmer’s rising.

Enjoy in moderation. 😉
See you…

Now he only talks about that…

Monday, May 21st, 2007

Registration for Windows Drivers’ course has already started operating this weekend. Because of some delays, the course starting date was postponed and has also been confirmed for June 23.

To see the complete list of extension courses offered by the university, select the item “Information technology” item from “Extension” on the University web site.

For those who enjoy creating Penguins, my hard-coder friend William, will be giving a course about driver development for Linux at the same university. He will also use one of the OSR hardware training kits which appear in the photo above just to give you the opportunity to get your hands dirty. In the case of Linux course, the hardware is the USB one.

See you…

Windows Drivers Course

Thursday, May 10th, 2007

As some of you might read in another post, I was invited by Gama Filho University to give a course about Kernel Mode development for Windows. All the course details have already been determined and they would be producing material for publication; bu, as this post was being written, I was notified that there had been a delay in producing this material and it would be available for May 21. I already took a look in the Folder they were producing, and from what I got, they decided to summarize the course description that would be given. For this reason, I’ll put the full version of the description here. The following was the file I sent to the university.

Aim:
========== 
This course is intended for developers or students who need to understand
the fundamental concepts on drivers' implementation for Windows. This course
would not cover specific drivers' implementation, such as printers, video,
SCSI, NDIS, USB, 1394 or UMDF. The aim of this course is to prepare students
who want to understand, test, complement or build drivers for Windows, using
general concepts involved in the process.
 
 
Pre-requisites:
==================
Knowledge in C Language 
Windows API Basics
Operating Systems Basics
 
 
Covered Topics:
=====================
System Architecture Overview
        Processes and Threads     
        Virtual Memory and Paging
        Kernel Mode x User Mode
        Subsystem and Native API
        IoManager
        Driver Stack and Plug-and-Play
        Object Manager
                Terminal Server
        Hardware Abstraction Layer (HAL)
 
Environment (Getting, installing and using)
        Windows Device Driver Kit
        Microsoft Visual Studio Express
        Microsoft Windows Debugging Tools
        Symbols
 
Writing a Driver
        Writing DriverEntry and DriverUnload
        Compiling a Driver
        Installing a Driver (Legacy)
                Dependencies
                Groups
                Load Order
        Debugging a Driver
                Checked Build Installations
                Driver Verifier
                Mapping an image for debugging
                Using Virtual Machines
                SoftIce
        Creating DeviceObject
        Symbolic Links
        I/O Request Packets
        IOCTLs and DeviceIoControl
        Implementing Dispatch Routines
                Buffered I/O
                Direct I/O
                Neither I/O
        Objects, Handles and Pointers
        Arbitrary Context
        IRQLs, APCs, DPCs and WorkItems
        Synchronism
                Mutex
                FastMutex
                ERESOURCE
                Spin Lock
        Events and Timers
        Custom Queues
 
Hardware Interaction
        Port I/O
        Interruptions and ISRs
        DMA
 
Writing Filters
        Writing AddDevice routine
        Legacy Filter Drivers
        Forwarding IRPs
        Stack Locations
        Completion Routines
        Pending IRPs Handling
        IRPs Cancelation
        Creating IRPs for third Drivers
 
Drivers Types
        Legacy drivers
        WDM Drivers
        Minidrivers
        Miniports
        Miniclass
 
Installations
        Creating an .INF file
        The use of SetupApi
 
References
        Web Sites
        Discussion Lists
        Books
 

By the time this post was written, the university attendance was not able to provide details about the course, such as registration dates, contents or due date. But I can anticipate what I know so far.

The course will be 40 hour-long and it is divided into 10 classes of four hours each. The classes will be on Saturdays from 1:00pm to 5:00pm.

The course is scheduled to have its first class starting May 26. It will necessary, at least, five students to form one class, but by taking the amount of people who have already contacted the university seeking for details (without disclosure) my concern is now the upper limit of 10 students. We decided to limit the class of 10 students in order there would be a better time usage for the content.

I agree that 40 hours is not enough to learn everything you need to develop drivers, but it will be an excellent starting point to have the first contact. If you are the type of person who needs to learn absolutely everything to start developing then I can antecipate that this course is not for you. The best kernel developers I know (from their Blogs, but I know) have been working with drivers for years and years, but they say they have never know everything. To get an idea, some developers focus on just certain issues within the kernel. One has been working only with disk drivers for about 10 years; another one,  for about seven years, only with network drivers. Tony Mason, for example, has been working for 18 years, only with File System Drivers. Now, ask them if they know everything! And I used to feel myself bad for trying to focus only on working with Kernel, refusing to work in User Mode. Sometimes, with friends, I have heard comments about how to do this or that using .Net, and I, having no idea what they were talking about. I didn’t know that inside the Kernel issue have still existed a myriad of details and specialization. Is it possible to learn everything?

I am preparing the content in a way that students may have some practical experience, such as writing and compiling a “Hello World” driver, install them in virtual machines and debug them. There is no way. It is necessary to get your hands dirty. Connect two real machines with a serial cable and do Kernel Debug. Generate and analyze Crash Dumps. I think we have to make the most possible to do things together in one classroom, and perform some experiments that the books attempt to describe only in words and pictures. This desire of putting things in practice was the responsible for contributing with me to get the training kit on sale at OSR Online. The kit that I’ll be taking to the course, and that appears in the photo above is basically a PCI Digital I/O. My goal is to make students’ drivers control this device.

Well, as soon as I’m getting news, I will let you know.
See you…