Windows function map? - windows

Is there some sort of thing like a layout/plan of the windows api? A clear overview of which api depends on another? Or a website where they are linked in a hierarchical way (starting with the most dependable, ending with the core function)
e.g Kerenel32.dll!CreateFile() -> ntdll.dll!ntCreateFIle() -> ntoskrnl32.exe!zwCreateFile()
I can link them all by hand with a dependency walker but it takes much time. So I was just wondering if something like this already existed.

I don't have the answer to your question, but I think an even more interesting road would be to read what Geoff Chappell has found out regarding the Windows Kernel and the Win32 API. I have not read those sections, but so far everything I've read on that website has filled me with wonder and awe at how thoroughly things can be analysed given a disciplined and talented investigator.

You can always take a look at ReactOS:
ReactOS® is a free, modern operating system based on the design of Windows® XP/2003. Written completely from scratch, it aims to follow the Windows-NT® architecture designed by Microsoft from the hardware level right through to the application level.
Simply search for whatever function in the documentation and look at its source. 99% of the time you can just pretend to be looking at the actual Windows source :) Very helpful when playing around with a debugger too.

Related

Is there a website to look up common, already written functions?

I'm sitting here writing a function that I'm positive has been written before, somewhere on earth. It's just too common to have not been attempted, and I'm wondering why I can't just go to a website and search for a function that I can then copy and paste into my project in 2 seconds, instead of wasting my day reinventing the wheel.
Sure there are certain libraries you can use, but where do you find these libraries and when they are absent, is there a site like I'm describing?
Possibly a wiki of some type that contains free code that anybody can edit and improve?
Edit: I can code things fine, I just don't know HOW to do them. So for example, right now, I'm trying to localize a robot/car/point in space. I KNOW there is a way to do it, just based off of range and distance. Triangulation and Trilateration. How to code that is a different story. A site that could have psuedo code, step by step how to do that would be ridiculously helpful. It would also ensure the optimal solution since everybody can edit it. I'm also writing in Matlab, which I hate because it's quirky, adding to my desire for creating a website like I describe.
StackOverflow.com. No, I'm not joking.
At its best, people come here saying "hasn't some library done X already", and very often the Collective Wisdom answers "yes". But the biggest obstacle is lack of a description language: even here, a big problem for many posters is describing the problem clearly enough for others to recognize it as something they've seen before.
And if people can't understand what you're trying to do, no search engine will.
Firstly, two caveats:
Copy and pasting code you don't understand is a bad idea. Make sure you understand exactly what the code does before you use it.
Make sure you respect the license of the code you are copying. This is important!
Those caveats aside, it's often language dependent. Languages with an open development ethos (not just an open source implementation, think Python as compared to Java) tend to have official archives of open source libraries. For example:
Perl (which probably started this trend) has CPAN
Python has PyPI and Python Cookbook
PHP has PEAR
C++ has boost
Ruby has gems
R has CRAN.
Haskell has Hoogle and Hackage
Furthermore, don't forget to look in your languages standard library. Some modern languages have massive standard libraries, which have often contained the functionality I am looking for:
Java has its API documentation
C# and VB.NET have the massive MSDN
Non-openly developed languages often have non-official community archives. For example:
C# tends to have a lot of code at CodePlex and CodeProject
MATLAB has the Matlab Central File Exchange
A third category of sites are language agnostic. They are often best search through POG (plain old-fashioned Google). For example:
Stack Overflow
SourceForge
The confusingly language agnostic Java2s
Planet source code
Github
Finally, a fourth category of sites that I find increasingly useful are source-code search engines:
Google Codesearch
Koders
You may also be able to find useful source code, or at least get help writing something, through various pastebins.
Pastebin is language-agnostic
HPaste is mostly Haskell, but has a little in other languages.
Often, at the end of the day it is easiest just to google it, though.
There is a wiki that contains free code that anybody can edit and improve:
Rosetta Code.
As a means of an overview there is the "Solutions by Programming Task" page.
From the former page:
"Rosetta Code is a programming chrestomathy site. The
idea is to present solutions to the same task in as
many different languages as possible, to demonstrate
how languages are similar and different, and to aid a
person with a grounding in one approach to a problem
in learning another."
Cutting and pasting code you find on the Internet into production code would be like chewing gum found in the street. - Mike Johnson
With that in mind, try sites that host opensource projects like GitHub, CodePlex, code.google.com, etc.
I'm not sure this question is language agnostic, but I use GitHub this way ;) Other languages may have places where this is possible.
Safari Bookshelf from O'Reilly has many, many books that contain many implementations from which to choose.
http://my.safaribooksonline.com/
I was a subscriber for a few years before coming to my current job, where we have a corporate account! It's one of the best perks, and one of the best resources I have available. I haven't bought a computer book in years.
Aside from sites like this (Stack Overflow) I don't think there's many, maybe CodePlex, but I almost marked you -1 for assuming that code found on the Internet is yours to copy.
I'd suggest reading about software licencing, I hope you'd at least comment where you got it from.

BOINC: Is there an easy example how to code a programm for it and how to implement it into their client/server system?

I did a numeric method as my diploma thesis and coded it in java. It needs a lot of computational time when adequately executed. So I looked for an alternative and found BOINC. Unfortunately I didn't have time for doing my method in BOINC, because I'm an Aerospace student and not a programmer and I decided to keep my priority on my java program. Now it's finished an I still would like to port this to BOINC environment.
Unfortunately I'm learning in re-doing examples and I couldn't find any, neither on the official site http://boinc.berkeley.edu nor in the internet.
So do you know a good and easy example or do you have any experience in BOINC and would like to start a new platform for such a boinc project?
I'm realistic about my method, that it wouldn't run 24/7, because there aren't as many work units as for seti or folding projects. So I would like to have a platform for more than just my project so that another platform project can be worked on, when one part of the project does not have any work units at that moment.
But to start this, I would keep it simple and just want to know how to code it and use it in the client and server system. It doesn't matter what the example projects will work on, as long as it is simple enough, that I can understand it and extending it for my method.
Thank you in advance, Andreas! :)
PS: I know that BOINC supports JAVA as a programming language, and my method is coded in JAVA.
As far as I know, JavaApps is just an idea; I don't know if anyone actually tried it in a real BOINC project. And it's Windows-only. And it seems to be a bit of a pain to redistribute the entire JRE as part of the BOINC application (both technically and legally).
Also, I generally dislike using that kind of “wrapper” where the science app (using the BOINC API) starts another process that then does the real computation. It's usually unreliable. There are lots of things that could go wrong with the wrapper, especially related to controlling the child process (eg. if something kills the wrapper, the child process has to quit too).
However, I just found something pretty interesting that may let me do a better Java wrapper for BOINC... Stay tuned! (but don't hold your breath either; it's the holidays!)
Meanwhile, I suggest you start by reading BOINC wiki and setting up a server with a “hello world” application; and if you have any trouble, ask a specific question about your trouble either here or in the boinc_projects mailing list.
(Of course, payin’ me to install the server for you is also an option ;) but I can't guarantee anything; not even my mere availability at this time of the year)

What problems will Microsoft's Oslo project solve?

I watched few videos/webcasts about "Oslo" but I still fail to see how it all comes together.
I understand that Oslo is a modeling platform.
What's the process to create a DSL?
Is it more than just a tool to create DSLs?
I understand that MGramma is used to create a DSL's syntax.
What is M language for?
What is MSchema?
After creating an MGrammar and compiling it to .mgx, what's the next step?
That Wikipedia article is pretty opaque.
The Microsoft project page for Oslo might be a better starting point. It begins:
About "Oslo"
”Oslo” is the codename for Microsoft’s
forthcoming modeling platform.
Modeling is used across a wide range
of domains and allows more people to
participate in application design and
allows developers to write
applications at a much higher level of
abstraction.
IMHO, it does seem more "fully buzzword compliant" than a real product. That said, it looks like there is some kind of demo or technology preview available for download. One might hope that they have included some samples that make it clearer what kinds of problems it is intended to solve.
Think of oslo as an excel/access replacement. Something for end users to model and process their data, without the need of developers.
MGrammer is where things get interesting for us, but the bits that are interesting are more of a v2 thing. You could think of it as excel macros done right.

Is Learning the win32 API Worthwhile? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I was certain that somebody would have specifically asked this question, but from what I can see no-one has (there's been a question about learning win32 but that doesn't cover whether it's worthwhile doing so).
I am very interested in gaining a deeper understanding of all the systems I use (I mostly program in C#, at least professionally), so I wondered, very simply - is learning win32 worthwhile, or is it overkill? Am I wasting my time? Is the knowledge I'd gain worth the effort?
Similar / related questions on StackOverflow:
Does it still make sense to learn low level WinAPI programming?
How relevant is Win32 programming to modern professionals?
Having a working knowledge of how Win32 works at the lowest level will certainly be invaluable if you are planning on doing Windows development in the future. It gives you a level of insight into things like Windows, Messaging and GDI that are hidden by the time you get to the level of .NET.
I wouldn't recommend you try and use Win32 for writing all your applications, but I feel that any Windows developer would benefit from writing a simple Win32 application using C/C++.
This is less true for things like WPF where there is less dependency on Win32, but just knowing how Win32 works will help you understand or appreciate some of the design decisions in WPF.
I advocate learning the concepts behind low level windows programming if all of the following are true.
You are going to do any windows programming.
You want to be the "go to" guy when the unexplainable happens.
You love to learn.
Abstraction layers like .NET work create and allow developers to do incredible things without having to know a lot. However, when .NET is used in a way unanticipated by its authors which reveals one of its subtle bugs, then that is the time where some win32 API knowledge goes a long way.
Will you ever have to write a message pump? I doubt it. Can it help diagnose problems? You betcha!
The question is much like, "Is learning assembly worthwhile"; and the answer is the same:
"Yes, because you will understand the fundamentals, and be able to perceive deeper than those who only work at the top level of abstraction".
However, by the same token, you probably won't be writing Win32 API directly 99.5% of the time.
When they invented C to replace assembly language, people where probably asking: "is it worthwhile to learn assembly language?" The value in knowing both was being able to drop to assembly to do the things which were impossible to accomplish in C (eg. trigger an interrupt).
The same can be said for Win32. There are some things which are impossible to do in C#. If you didn't know the win32 api, then you would dismiss some things as being impossible. However, once you know what you are missing, in those rare situations, you would be able to "drop to win32" and do them.
Another way of looking at it is this: programming is all about being able to think in multiple levels of abstraction at the same time. For example, if you know your language uses immutable strings, you don't write an algorithm that adds a single character to one 10000 times, because it will be slow. If you know the win32 api, you will be able to think about how each line you write in C# is actually implemented and that will help you write better code.
At least for me, learning an API (I'm assuming that "in-depth" is implied) that I don't use is a waste of time. I'd rather spend my limited amount of time and brain power learning new concepts or exploring new tools than becoming intimately familiar with an existing tool that I don't need to use now. When I need a particular tool that I don't have or have to use a tool that I'm not familiar with, that's the time to learn it in some depth. Before that I might do enough investigation to know whether it is going to be useful to me or not, but not much more.
Yes, the principles of the Win32 API are useful to learn - these principles are the foundation on which everything else is built.
The .NET APIs for GUI development, both Windows.Forms and WPF, do what they do within the constraints of what is possible on top of the Win32 API. Key architectural decisions of these frameworks were constrained and informed by the Win32 API.
On the other hand, you are less likely to get a lot of value from diving deep into the API, as there is a lot to learn, and given that you spend most of your time working in C#, you'll have less opportunity to use the knowledge directly.
BTW, the same applies to other technologies as well - like networking, cryptography and hardware design. Learning the fundamentals will help you become a better developer.
Yes, you should learn the basics of how Windows (a lot of this stuff predates Win32) operates. Why? For the same reason as I understand how a mortise and tenon joint operates, even though I don't make my own furniture, or why I understand how an internal combustion engine works even though I don't do my own car maintenance.
You work at a higher level of abstraction, which is nice, but when that abstraction leaks - that's not an "if", that's a "when" - if you don't understand the basics of Windows, you'll be lost. If you don't know at least some of the API, you won't have a clue where to look if you need to P/Invoke functionality not available in .Net.
Quite apart from that, isn't curiousity reason enough?
If you are trying to write a VB6 application then the Win32 API allows you to do a lot of things that are not natively supported by VB6.
If you're writing a C# WinForms app then I would recommend learning the vast reaches of the .NET Framework first.
Edit
If you really want to know what's going on under the hood in Windows then you might want to check out a copy of Programming Windows 3.1 by Charles Petzold.
I personally think it's still worthwhile learning the Win32 API.
As far as I recall when I started learning Win32 (after doing some VB(A), Pascal, etc.) I learned a lot about Windows and understood how thing works in Windows. Everything was so clearer. :)
So, as per your question - you will learn a lot about Windows through learning Win32.
As you said - you're a C# programmer and I'm not sure if you'll use it often, because almost everything you need is already there, in .NET.
I won't repeat over and over what the others said many times already.
Here's a link to a Win32 tutorial with which I am currently learning along the basics of Win32's. I find it pretty interesting and easy to follow.
This tutorial helps me get what I didn't understand first, back when I've begun to program in my secondary school years.
If I were to start today, I wouldn't learn the entire API. However, I do think that the basic concepts are important to understand, with an understanding of how message loops work as the top priority.
You'll never be able to just "learn" the entire win32 API, it's too much to take in, and it will be a moving target. If you develop in C#, there's no real point.
That said, try creating Notepad using plain C and just API calls. That will teach you enough for a C# developer to at least appreciate it.
A lot of the "No" answers here seem to focus on learning the actual methods, structs, and what not available in the API. I'd say yes, but focus not on the individual components of the API, but the overall design and the way it functions. It's much easier to troubleshoot even .NET code when you understand what's happening at the core level of the operating system.
This question looks a bit dated, but I'll answer anyway.
Answer: Complicated: yes. Simple: probably not necessary.
It really depends on what you need to do. If you need to use a feature not current supported by .NET, have-at-er. But be careful, most of the coddling the Framework provides Win32 does not, and if you do something incredibly stupid, your machine WILL bluescreen.
I know when .NET first came out, I had have no interest to learn Win32, .NET was here and it was such an improvement. But the sad fact about Windows is this: all new features in Windows are implemented in native code first, period. If you want to use any part of Windows before .NET wraps it, you're either using Win32 from C++ or Win32 from C# or from VB.NET. .NET is a wrapper, for all the stuff in Win32. So if you can't wait, yes, you can Interop into the lower bowels of the OS if you'd like.
Knowing Win32 and probably one day Win64 (whatever they happen to call it) will always be a useful skill. Any whizzbang technology requires underpinnings somewhere.
.NET is implemented using win32 api, anyone wishing to possess deeper understanding of .NET would greatly benefit from having at least marginal knowlege of win32api.
In your career it will be unlikely that you will only be creating greenfield applications where you will have the freedom to choose the technology and programming languages used.
Sooner or later you will have to integrate with old code written in Win32 and C/C++. In that case, knowledge of Win32 will help, especially if you are integrating using PInvoke or C++/CLI.
Misuse the .NET framework and Win32 and your machine will blue screen? Somehow I doubt that.
The biggest value to knowing Win32 (or assembly language) is that when something doesn't work as expected and you have to debug it. The more you know about the underlying system, the easier time you will have debugging the problem.
I like to further add to this. I never formally studied Win32 API/MFC. I started using Visual C++ 4 when I first got interested in GUI programming. Anyway, I wish I kept that foundation then, as I never caught on quick enough (I was rather young then, actually), so I studied Visual Basic instead.
For some reason, Delphi never interested me even though I knew Pascal well enough, but I digress. These days, I work in IT and develop installer scripts in NSIS - and every so often I need additional functionality that NSIS doesn't provide, so I make my own plugin and to keep it quick and dependency free, I opt for Win32 API opposed to MFC or even full blown C++.
The main reason for this comment, is that my own curiosity got me hooked. I like to know more, so where is the best resource for learning the API. A book? Website?
Would MFC still be worth tackling as well? I did see a website about a fellow that develops Win32 GUI apps, in assembly! I think that is overkill, honestly, but it is compact, fast code, interesting, the concept, but I never was able to get the hang of 80x86 assembly (hell, even RISC assembly in college I never was able to do!)
I think it's always interesting to know how a system works if your work relies on it. I don't mean you should learn every bit of it, but still get a good understanding, at least to be able to search more by yourself the day you will have to.
Software is not magic - well... ok... for 99% of the cases :-)
Here is a link to an excellent article about "magical thinking" and "GUID goblins" from Eric Lippert's about that subject: It's not Magic

Does it still make sense to learn low level WinAPI programming? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Does it make sense, having all of the C#-managed-bliss, to go back to Petzold's Programming Windows and try to produce code w/ pure WinAPI?
What can be learn from it? Isn't it just too outdated to be useful?
This question is bordering on religious :) But I'll give my thoughts anyway.
I do see value in learing the Win32 API. Most, if not all, GUI libraries (managed or unmanaged) result in calls to the Win32 API. Even the most thorough libraries don't cover 100% of the API, and hence there are always gaps which need to be plugged by direct API calls or P/invoking. Some of the names of the wrappers around the API calls have similar names to the underlying API calls, but those names aren't exactly self-documenting. So understanding the underlying API, and the terminology used therein, will aid in understanding the wrapper APIs and what they actually do.
Plus, if you understand the nature of the underlying APIs that are used by frameworks, then you will make better choices with regards to which library functionality you should use in a given scenario.
Cheers!
I kept to standard C/C++ for years before learning Win32 API, and to be quite blunt, the "learning Win32 API" part is not the best technical experience of my life.
In one hand Win32 API is quite cool. It's like an extension of the C standard API (who needs fopen when you can have CreateFile. But I guess UNIX/Linux/WhateverOS have the same gizmo functions. Anyway, in Unix/Linux, they have the "Everything is a file". In Windows, they have the "Everything is a... Window" (no kidding! See CreateWindow!).
In the other hand, this is a legacy API. You will be dealing with raw C, and raw C madness.
Like telling one's structure its own size to pass through a void * pointer to some Win32 function.
Messaging can be quite confusing, too: Mixing C++ objects with Win32 windows lead to very interesting examples of Chicken or Egg problem (funny moments when you write a kind of delete this ; in a class method).
Having to subclass a WinProc when you're more familiar with object inheritance is head-splitting and less than optimal.
And of course, there is the joy of "Why in this fracking world they did this thing this way ??" moments when you strike your keyboard with your head once too many and get back home with keys engraved in your forehead, just because someone thought it more logical to write an API to enable the changing of the color of a "Window", not by changing one of its properties, but by asking it to its parent window.
etc.
In the last hand (three hands ???), consider that some people working with legacy APIs are themselves using legacy code styling. The moment you hear "const is for dummies" or "I don't use namespaces because they decrease the runtime speed", or the even better "Hey, who needs C++? I code in my own brand of object-oriented C!!!" (No kidding... In a professional environment, and the result was quite a sight...), you'll feel the kind of dread only condemned feel in front of the guillotine.
So... All in all, it's an interesting experience.
Edit
After re-reading this post, I see it could be seen as overly negative. It is not.
It is sometimes interesting (as well as frustrating) to know how the things work under the hood. You'll understand that, despite enormous (impossible?) constraints, the Win32 API team did wonderful work to be sure everything, from you "olde Win16 program" to your "last Win64 over-the-top application", can work together, in the past, now, and in the future.
The question is: Do you really want to?
Because spending weeks to do things that could be done (and done better) in other more high-level and/or object-oriented API can be quite de-motivational (real life experience: 3 weeks for Win API, against 4 hours in three other languages and/or libraries).
Anyway, you'll find Raymond Chen's Blog very interesting because of his insider's view on both Win API and its evolution through the years:
https://blogs.msdn.microsoft.com/oldnewthing/
Absolutely. When nobody knows the low level, who will update and write the high level languages? Also, when you understand the low level stuff, you can write more efficient code in a higher level language, and also debug more efficiently.
The native APIs are the "real" operating system APIs. The .NET library is (with few exceptions) nothing more than a fancy wrapper around them. So yes, I'd say that anybody who can understand .NET with all its complexity, can understand relatively mundane things like talking to the API without the benefit of a middle-man.
Just try to do DLL Injection from managed code. It can't be done. You will be forced to write native code for this, for windowing tweaks, for real subclassing, and a dozen other things.
So yes: you should (must) know both.
Edit: even if you plan to use P/Invoke.
On the assumption that you're building apps targeted at Windows:
it can sure be informative to understand lower levels of the system - how they work, how your code interacts with them (even if only indirectly), and where you have additional options that aren't available in the higher-level abstractions
there are times when your code might not be as efficient, high-performance or precise enough for your requirements
However, in more and more cases, folks like us (who never learned "unmanaged coding") will be able to pull off the programming we're trying to do without "learning" Win32.
Further, there's plenty of sites that provide working samples, code fragments and even fully-functional source code that you can "leverage" (borrow, plagiarize - but check that you're complying with any re-use license or copyright!) to fill in any gaps that aren't handled by the .NET framework class libraries (or the libraries that you can download or license).
If you can pull off the feats you need without messing around in Win32, and you're doing a good job of developing well-formed, readable managed code, then I'd say mastering .NET would be a better choice than spreading yourself thin over two very different environments.
If you frequently need to leverage those features of Windows that haven't received good Framework class library coverage, then by all means, learn the skills you need.
I've personally spent far too much time worrying about the "other areas" of coding that I'm supposed to understand to produce "good programs", but there's plenty of masochists out there that think everyone's needs and desires are like their own. Misery loves company. :)
On the assumption that you're building apps for the "Web 2.0" world, or that would be just as useful/beneficial to *NIX & MacOS users:
Stick with languages and compilers that target as many cross-platform environments as possible.
pure .NET in Visual Studio is better than Win32 obviously, but developing against the MONO libraries, perhaps using the Sharp Develop IDE, is probably an even better approach.
you could also spend your time learning Java, and those skills would transfer very well to C# programming (plus the Java code would theoretically run on any platform with the matching JRE). I've heard it said that Java is more like "write once, debug everywhere", but that's probably as true as (or even moreso than) C#.
Analogy: If you build cars for a living (programming), then its very pertinent to know how the engine works (Win32).
Simple answer, YES.
This is the answer to any question that is like.. "does it make sense to learn a low level language/api X even when a higher level language/api Y is there"
YES
You are able to boot up your Windows PC (or any other OS) and ask this question in SO because a couple of guys in Microsoft wrote 16-bit assembly code that loads your OS.
Your browser works because someone wrote an OS kernel in C that serves all your browser's requests.
It goes all the way up to scripting languages.
Big or small, there is always a market and opportunity to write something in any level of abstraction. You just have to like it and fit in the right job.
No api/language at any level of abstraction is irrelevent unless there is a better one competing at the same level.
Another way of looking at it: A good example from one of Michael Abrash's book: A C programmer was given the task of writing a function to clear the screen. Since C was a better (higher level) abstraction over assembly and all, the programmer only knew C and knew it well. He did his best - he moved the cursor to each location on the screen and cleared the character there. He optimized the loop and made sure it ran as fast as it could. But still it was slow... until some guy came in and said there was some BIOS/VGA instruction or something that could clear the screen instantly.
It always helps to know what you are walking on.
Yes, for a few reasons:
1) .net wraps Win32 code. .net is usually a superior system to code against, but having some knowledge of the underlying Win32 layer (oops, WinAPI now that there is 64-bit code too) bolsters your knowledge of what is really happening.
2) in this economy, it is better to have some advantages over the other guy when you are looking for a job. Some WinAPI experience may provide this for you.
3) some system aspects are not available through the .net framework yet, and if you want to access those features you will need to use p/invoke (see http://www.pinvoke.net for some help there). Having at least a smattering of WinAPI experience will make your p/invoke development effort a lot more efficient.
4) (added) Now that Win8 has been around for awhile, it is still built on top of the WinAPI. iOS, Android, OS/X, and Linux are all out there, but the WinAPI will still be out there for many many years.
Learning a new programming language or technology is for one of three reasons:
1. Need: you're starting a project for building a web application and you don't know anything about ASP.NET
2. Enthusiasm: you're very excited about ASP.NET MVC. why not try that?
3. Free time: but who has that anyway.
The best reason to learn something new is Need. If you need to do something that the .NET framework can't do (like performance for example) then WinAPI is your solution. Until then we keep ourself busy with learning about .NET
For most needs on the desktop you wont need to know the Win32, however there is a LOT of Win32 not in .NET, but it is in the outlaying stuff that may end up being less than 1% of your application.
USB support, HID support, Windows Media Foundation just off the top of my head. There are many cool Vista API's only available from Win32.
You will do yourself a large favor by learning how to do interop with a Win32 API, if you do desktop programing, because when you do need to call Win32, and you will, you won't spend weeks scratching your head.
Personally I don't really like the Win32 API but there's value in learning it as the API will allow more control and efficiency using the GUI than a language like Visual Basic, and I believe that if you're going to make a living writing software you should know the API even if you don't use it directly. This is for reasons similar to the reasons it's good to learn C, like how a strcpy takes more time than copying an integer, or why you should use pointers to arrays as function parameters instead of arrays by value.
Learning C or a lower level language can definitely be useful. However, I don't see any obvious advantage in using the unmanaged WinAPI.
I've seen low level Windows API code... it ain't pretty... I wish I could unlearn it. I think it benefits to learn low level as in C, as you gain a better understanding of the hardware architecture and how all that stuff works. Learning old Windows API... I think that stuff can be left to the people at Microsoft who may need to learn it to build higher level languages and API... they built it, let them suffer with it ;-)
However, if you happen to find a situation where you feel you just can't do what you need to do in a higher level language (few and far between), then perhaps start the dangerous dive into that world.
yes. take a look at uTorrent, an amazing piece of software efficiency. Half of it's small size is due to the fact that much of it's core components were re-written to not use gargatuian libraries.
Much of this couldn't be done without understanding how these libraries interface with the lower level API's
It's important to know what is available with the Windows API. I don't think you need to crank out code with it, but you should know how it works. The .NET Framework contains a lot of functionality, but it doesn't provide managed code equivalents for the entire Windows API. Sometimes you have to get a bit closer to the metal, and knowing what's down there and how it behaves will give you a better understanding of how to use it.
This is really the same as the question, should I learn a low level language like C (or even assembler).
Coding in it is certainly slower (though of course the result is much faster), but its true advantage is you gain an insight into what is happening at close to the system level, rather than than just understanding someone else's metaphor for what is going on.
It can also be better when things won't work well, or fast enough or with the sort of granularity that you need. (And do at least some subclassing and superclassing.)
I'll put it this way. I don't like programming to the Win32 API. It can be a pain compared to managed code. BUT, I'm glad I know it because I can write programs that otherwise I wouldn't be able to. I can write programs that other people can't. Plus it gives you more insight into what your managed code is doing behind the scenes.
The amount of value you get out of learning the Win32 API, (aside from the sorts of general insights you get from learning about how the nuts and bolts of the machine fit together) depends on what you're trying to achieve. A lot of the Win32 API has been wrapped nicely in .NET library classes, but not all of it. If for instance you're looking to do some serious audio programming, that portion of the Win32 API would be an excellent subject of study because only the most basic of operations are available from .NET classes. Last I checked even the managed DirectX DirectSound library was awful.
At the risk of shameless self-promotion....
I just came across a situation where the Win32 API was my only option. I want to have different tooltips on each item in a listbox. I wrote up how I did it on this question.
Even in very very high level languages you still make use of the API. Why? Well not every aspect of the API has been replicated by the various libraries, frameworks, etc. You need to learn the API for as long as you will need the API to accomplish what you are trying to do. (And no longer.)
Apart from some very special cases when you need direct access to APIs, I would say NO.
There is considerable time and effort required to learn to implement the native API calls correctly and the returning value is just not worth it. I would rather spend the time learning some new hot technology or framework that will make your life easier and programming less painful. Not decades-old obsolete COM libraries that nobody really uses anymore (sorry to COM users).
Please don't stone me for this view. I know a lot of engineers here have really curious souls and there is nothing wrong with learning how things work. Curiousity is good and really helps understanding. But from a managerial point of view, I would rather spend a week learning how to develop Android apps than how to calls OLEs or COMs.
If you planning to develop a cross platform application, If you use win32, then your application could easily run on linux through WINE. This results in a highly maintainable application. This is one of the advantages of learning win32.

Resources