Windows was written in which language

Which language was used to create Windows 8? [closed]

So I was wandering which language was used to produce this new appearance: C++ or C#?

Is there a WPF running on that UI?

2 Answers 2

Windows is written in C, C++, and some hand-tuned Assembly. For reasons why it is not written in .NET, see this question.

It is not clear which of those languages was used to develop the latest eye candy in Windows 8.

I can’t really say for sure, since I’m not a member of the development team, but it’s almost certainly written in C++. And, then, since it’s not a ground-up rewrite, there’s bound to be a bunch of C and assembly code along for the ride, as well. Both legacy code that remains for backwards compatibility as well as important, functioning code like the bootstrapping sequences.

As for how they’ve implemented the fancy UI effects, their mere existence doesn’t imply that a certain UI framework is in use. Anything that you can do in WPF can be done on a more direct level from C++ code. In fact, it must be possible to do such, as WPF is merely calling platform APIs under the hood, like DirectDraw, etc. to do all the work. Of course, it goes without saying that it’s far easier to use a wrapper library like WPF, but it’s not strictly necessary. And there are plenty of reasons that Windows can’t move over to the world of managed code, at least not just yet or any time in the realistic future.

The Windows Shell team has long been known to use their own proprietary controls with the class name DIRECTUIHWND . Many a programmer has examined the OS widgets with a tool like Spy++ to find the answer to «how did they do that?» and reached the same conclusion. My guess is that they’re using the same toolset, extended for some of the new whizbang features. They’re keeping it all internal, of course. Once you expose an API for other developers to use, you effectively lose ownership of it because you’re bound by the API contract to ensure that it continues to work on all future versions. Radical changes like the ones you’re seeing in Windows 8 would be far more difficult if they had to ensure backwards compatibility with the internal UI components of the shell used to implement these features.

What languages are Windows, Mac OS X and Linux written in?

I was just wondering who knows what programming languages Windows, Mac OS X and Linux are made up from and what languages are used for each part of the OS (ie: Kernel, plug-in architecture, GUI components, etc).

I assume that there are multiple languages for each and obviously I know the Linux kernel is written in C.

I’m totally guessing here that Mac OS X contains a lot of Objective-C code as it is Apple’s language derived from NeXT.

Windows, I have heard contains C, C++ and Intel Assembly. Do Linux or Mac OS contain any Assembly code?

Also, are there scripting languages like Ruby, Python, etc used by the OS developers for scripting parts of the OS? What parts of the OS would be written in each language?

14 Answers 14

  • Windows: C++, kernel is in C
  • Mac: Objective C, kernel is in C (IO PnP subsystem is Embedded C++)
  • Linux: Most things are in C, many userland apps are in Python, KDE is all C++

All kernels will use some assembly code as well.

Linux: C. Some parts in assembly.

[. ] It’s mostly in C, but most people wouldn’t call what I write C. It uses every conceivable feature of the 386 I could find, as it was also a project to teach me about the 386. As already mentioned, it uses a MMU, for both paging (not to disk yet) and segmentation. It’s the segmentation that makes it REALLY 386 dependent (every task has a 64Mb segment for code & data — max 64 tasks in 4Gb. Anybody who needs more than 64Mb/task — tough cookies). [. ] Some of my «C»-files (specifically mm.c) are almost as much assembler as C. [. ] Unlike minix, I also happen to LIKE interrupts, so interrupts are handled without trying to hide the reason behind them. (Source)

Mac OS X: Cocoa mostly in Objective-C. Kernel written in C, some parts in assembly.

Mac OS X, at the kernel layer, is mostly an older, free operating system called BSD (specifically, it’s Darwin, a sort of hybrid of BSD, Mach, and a few other things). almost entirely C, with a bit of assembler thrown in. (Source)

Much of Cocoa is implemented in Objective-C, an object-oriented language that is compiled to run at incredible speed, yet employes a truly dynamic runtime making it uniquely flexible. Because Objective-C is a superset of C, it is easy to mix C and even C++ into your Cocoa applications. (Source)

Читайте также:  Загрузка безопасного режима windows 10 через биос

Windows: C, C++, C#. Some parts in assembler.

We use almost entirely C, C++, and C# for Windows. Some areas of code are hand tuned/hand written assembly. (Source)

What language is used to write operating systems (Windows)? [closed]

Want to improve this question? Update the question so it’s on-topic for Stack Overflow.

Closed 10 years ago .

What is the language used to write operating systems (Windows) or a boot CD?

5 Answers 5

Boot loaders are usually written in Assembly, as well as low-level kernel parts, like hardware drivers.
The kernel itself can be written in different languages, like Assembly, C or C++.

Maybe you want to look into the Singularity Project.

Its from Microsoft Reseach, on how today a OS could be built.

there you find a lot of papers, on the concepts of building an OS.

Operating Systems can be written in pretty much any language, and there are plenty of Operating Systems written in an whole bunch of languages. Just a couple of examples:

  • Singularity is written in Sing# which is a superset of Spec#, which in turn is a superset of C#
  • House is written in Haskell
  • all of the Lisp OS’s are written in Lisp
  • there are several Smalltalk OSs written in Smalltalk
  • many embeddded OSs are written in Forth
  • SharpOS and Cosmos are written in C#
  • NewOS and JNode are written in Java
  • Ununumium used to be written largely in Python, but now they have shifted their focus, it is written largely in assembly
  • You can argue whether JS/UX is an OS or not, but it is written in JavaScript
  • Modula-2 was explicitly invented for the purpose of writing an OS
  • Oberon also was explicitly invented for OS development
  • the original MacOS was written in Pascal
  • the original OS/400 was written in Modula-2 and PL/MI
  • Eleanor McHugh has some preliminary ideas for writing an OS in Ruby
  • the Windows NT kernel is written largely in C, however the farther away you get from the kernel, there might be some C++ or even C# in there

I’m pretty sure the earliest versions of Windows were written primarily in Pascal. That’s why you can still find references to pascal calling conventions in old documents and header files, though AFAIK those conventions only ever applied to 16 bit Windows.

[EDIT — I’m now pretty sure I was told a while ago that this is wrong. Microsoft had reasons for using Pascal call conventions that I don’t remember, but didn’t use Pascal for coding Windows (or the majority of it or whatever)].

These days, Windows is probably written in a mixture of languages, though with the emphasis strongly on C and C++. For example, some parts of .NET are probably written in C#, and these days that easily counts as an O/S component.

Similarly, I’ll bet there are at least a few Objective C components in modern versions of the Mac O/S.

There are a lot of languages that are somewhat suited to writing operating systems. In niche areas, I’m certain you’ll find Ada, Modula 2 and more.

Читайте также:  Установить word без windows

Imperative languages without garbage collection are probably most common because of the relative ease of interfacing to hardware and assembler code. However, most functional languages are impure. There are low-level versions of Lisp around, if you look hard enough. And ML-family languages and Haskell have probably been used in operating systems, at least for research/academic purposes.

In fact, I wouldn’t be surprised to find even a bit of Prolog in some operating systems components — and certainly some code written using custom-made domain specific languages.

Find Programming Language Used

Whats the easiest way to find out what programming language an application was written in? I would like to know if its vb or c++ or delphi or .net etc from the program exe file.

13 Answers 13

of course if they used a packer, some unpacking will need to be done first 🙂

Start it up and check what run-time DLLs it uses with Process Explorer.

If that doesn’t make it immediately obvious, search the web for references to those DLLs.

Most disassemblers (including Olly I think) can easily show you the text contained in an EXE or DLL, and that can also sometimes give a clue. Delphi types are often prefixed with T as in TMyClass.

If it’s a small executable with no DLL references and no text you might be SOL. At that point you’d need to look for idioms of particular compilers, and it would be mostly guesswork.

There is an art to detecting what language a program was written in. It is possible but there are no hard and fast rules. It takes a lot of experience (and it also leads to the question «Why would you want to. » but here are a few ideas on how to go about it.

What you’re looking for is a «signature». The signature could be a certain string that is included by the compiler, a reference to an API that is quite common in the programming tool being used, or even a style of programing that is common to the tools being used, visible in the strings contained in the application.

In addition, there are styles to how an application is deployed: various configuration files found in the deployment directory, dlls and assemblies and even images, directories or icons.

Java applications wrapped in a self-launching executable will contain references to java libs, and will likely have certain libraries or files included in the same directory that indicate that it’s java.

As indicated in other answers a managed assembly will show certain signs as well: you can open it in Reflector etc. While it is correct that c# and VB are «interchangable» once compiled, it is not true that they are identical. If you use Reflector to disassemble VB code you will quite often see that the assembly references the Microsoft.VisualBasic.dll assembly. You’ll be able to tell the difference between Mono applications because they will most likely contain references to the mono assemblies.

Many compilers assemble and link code in certain ways, and leave footprints behind. For example, examining a window executable using «strings: tab in Process Explorer, you’ll see a lot of strings. Using these you may be able to determine programming styles, methods called, error or trace methods withint the exe.

An example is that compilers use different mechanisms for localization: Microsoft stores localized strings in XML files or resource files. Other compilers will use a different tactic.

Another example is c++ name mangling. The CodeWarrior compiler uses a different algorithm to mangle the names of the member variables and functions of a call than Visual Studio.

I suppose you could write a book on the subject of accurately determining the lineage of any executable. This subject would probably be called «programming archeology».

In which language is cmd.exe written?

Command Prompt, also known as cmd.exe or cmd (after its executable file name), is the command-line interpreter on Windows NT, Windows CE, OS/2 and eComStation operating systems. It is the counterpart of COMMAND.COM in DOS and Windows 9x systems (where it is also called «MS-DOS Prompt»), and analogous to the Unix shells used on Unix-like systems.

I have searched everywhere but could not get an answer for this question.

Читайте также:  Что такое макросы windows

Each website focuses on the fact that batch language is used in cmd.exe but I could not find the language in which it is written.

So my question is:

What is the language that was used to write command-prompt or cmd.exe in Windows?

2 Answers 2

The file, when opened in a text editor, contains the path onecore\base\cmd\maxpathawarestring.cpp , which would indicate that at least one source file is written in C++.

The imports it depends on makes it is likely to be a mix of C and C++. CRT functions like longjmp , calloc , free indicate C code, might well be ancient and hark back to the command.com days. It clearly also uses C++ exception handling, C++ is their weapon of choice for all recent code development. Mixing is not uncommon.

under a debugger it’s obvious that recent additions to CMD have been written in C++. x cmd!*::* shows significant use of the C++ std namespace

But CMD is still mostly C, not C++. Its commands and support functions are implemented as C functions such as eExit , eChdir , ParseStatement , SearchForExecutable , and ExecPgm . They haven’t ported all of this old C code to an OOP design.

So I’d go with a mix of C and C++.

As officially confirmed by MS’ Rich Turner, originally it’s written in C

Cmd is a Win32 app written entirely in ‘C’ — this is important since one of the key goals of NT was to be portable across many different processor and machine architectures

but parts of it were migrated to C++ as of now

Inside the Windows Console

Windows Console is a traditional Win32 executable and, though it was originally written in ‘C’, much of the code is being migrated to modern C++ as the team modernizes and modularizes Console’s codebase.

For those who care about such things: Many have asked whether Windows is written in C or C++. The answer is that — despite NT’s Object-Based design — like most OS’, Windows is almost entirely written in ‘C’. Why? C++ introduces a cost in terms of memory footprint, and code execution overhead. Even today, the hidden costs of code written in C++ can be surprising, but back in the late 1990’s, when memory cost

$60/MB (yes … $60 per MEGABYTE!), the hidden memory cost of vtables etc. was significant. In addition, the cost of virtual-method call indirection and object-dereferencing could result in very significant performance & scale penalties for C++ code at that time. While one still needs to be careful, the performance overhead of modern C++ on modern computers is much less of a concern, and is often an acceptable trade-off considering its security, readability, and maintainability benefits . which is why we’re steadily upgrading the Console’s code to modern C++.

If you look into the latest Windows Console’s internals structure you can see that it uses Map , Collection which suggests that it likely uses some C++/CX

From the top (original buffer’s blue boxes):

  • ScreenInfo – maintains information about the viewport, etc., and contains a TextBuffer
    • TextBuffer – represents the Console’s text area as a collection of rows
      • Row – uniquely represents each CharRow in the console and the formatting attributes applied to each row
        • CharRow – contains a collection of CharRowCells, and the logic and state to handle row wrapping & navigation
          • CharRowCell – contains the actual cell’s text, and a DbcsAttribute byte containing cell-specific flags

In case you’re interested then conhost.exe has also been open sourced, under the form of the new Windows terminal

The Windows console host, conhost.exe , is Windows’ original command-line user experience. It implements Windows’ command-line infrastructure, and is responsible for hosting the Windows Console API, input engine, rendering engine, and user preferences. The console host code in this repository is the actual source from which the conhost.exe in Windows itself is built.

You can find more pretty good articles with detailed information in the Windows command line blog

Оцените статью