Page 1 of 2

Complete Windows Source Code

Posted: Sat Jun 02, 2007 11:07 pm
by pcmattman
I thought this was funny:

Code: Select all

 /* Source Code to Windows 2000 */
 /* Compiled by Rajiv */
 
 #include "win31.h"
 #include "win95.h"
 #include "win98.h"
 #include "workst~1.h"
 #include "evenmore.h"
 #include "oldstuff.h"
 #include "billrulz.h"
 #include "monopoly.h"
 #define INSTALL = HARD
 
 char make_prog_look_big[1600000];
 
 void main()
 {
 while(!CRASHED)
 {
 display_copyright_message();
 display_bill_rules_message();
 do_nothing_loop();
 if (first_time_installation)
 {
 make_50_megabyte_swapfile();
 do_nothing_loop();
 totally_screw_up_HPFS_file_system();
 search_and_destroy_the_rest_of_OS/2();
 make_futile_attempt_to_damage_Linux();
 disable_Netscape();
 disable_RealPlayer();
 disable_Lotus_Products();
 hang_system();
 }
 
 write_something(anything);
 display_copyright_message();
 do_nothing_loop();
 do_some_stuff();
 
 if (still_not_crashed)
 {
 display_copyright_message();
 do_nothing_loop();
 basically_run_windows_3.1();
 do_nothing_loop();
 do_nothing_loop();
 }
 }
 
 if (detect_cache())
 disable_cache();
 
 if (fast_cpu())
 {
 set_wait_states(lots);
 set_mouse(speed, very_slow);
 set_mouse(action, jumpy);
 set_mouse(reaction, sometimes);
 }
 /* printf("Welcome to Windows 3.1"); */
 /* printf("Welcome to Windows 3.11"); */
 /* printf("Welcome to Windows 95"); */
 /* printf("Welcome to Windows NT 3.0"); */
 /* printf("Welcome toW indows 98"); */
 /* printf("Welcome to Windows NT 4.0"); */
 printf("Welcome to Windows 2000");
 
 if (system_ok())
 crash(to_dos_prompt)
 else
 system_memory = open("a:\swp0001.swp",O_CREATE);
 while(something)
 {
 sleep(5);
 get_user_input();
 sleep(5);
 act_on_user_input();
 sleep(5);
 }
 create_general_protection_fault();
 }
 }

Posted: Sun Jun 03, 2007 8:31 am
by Bughunter
What's so funny about this? This is real-life! :lol:

Posted: Sun Jun 03, 2007 8:34 am
by GLneo

Code: Select all

/*
	TOP SECRET Microsoft(c) Code
	Project: Chicago(tm)
	Projected release-date: Summer 1998

	Fixed a few bugs, and renamed it to Windows 98
	- Jimmy
*/

#include "win31.h"
#include "win95.h"
#include "appleOS7.h"
#include "dos6.h"
#include "evenmore.h"
#include "oldstuff.h"
/* #include "unistd.h"  -- needed if you compile on Unix, much faster this way */

/* Make users think they're getting "value for money" */
#ifdef _WINDOWS_98_
	#include "dvd.h"
#endif
 
char make_prog_look_big[4194304];
#ifdef _WINDOWS_98_
	char make_prog_look_bigger[8388608];
#endif
 
void main(void) {
	short sleep_time;
 
	while(!CRASHED) {
 
		display_copyright_message();
		sleep(60);
 
		if (first_time_installation()) {
			make_swapfile(rand()%85);    /* random-sized swap file 'cos what the hell  ??  */
			sleep(60);

/* IMPORTANT!  Remove the following five lines if Department Of Justice
   require this portion of code */
			totally_screw_up_HPFS_file_system();
			search_and_destroy_the_rest_of_OS/2();
			search_and_destroy_Netscape();
			tamper_with_realnetworks_code();
			search_and_destroy_not-microsoft();

			if ((rand()%2)==0) flag_installation_successful();
			hang_system();
		}
		sleep(60);
		do_some_fancy_graphics();
		sleep(60);
	}
 
	if (still_not_crashed) {
		display_copyright_message();
		sleep(60);
		run_windows_3.1();
		sleep(120);
	}
 
	if (detect_cache()) disable_cache();
	if (fast_cpu() && !COMPAQ) {     /* We did a deal with Compaq */
		set_wait_states(lots);
		set_mouse(speed, very_slow);
		set_mouse(action, jumpy);
		set_mouse(reaction, sometimes);
	}

	/* printf("Welcome to MacOS"); */
	/* printf("Welcome to Windows 3.11"); */
	/* printf("Welcome to Windows 95"); */
 
	printf("Welcome to Windows 98");
 
	if (system_ok()) crash(to_dos_prompt);
	else system_memory = open("a:\swp0001.swp", O_CREATE);
 
/* Windows 98 should be "faster" than Windows 95 */
	#ifdef ( _WINDOWS_98_ || _WINDOWS_NT_ )
		sleep_time=2;
	#else
		#ifdef _WINDOWS_95_
			sleep_time=5;
		#else
			sleep_time=8;
		#endif
	#endif

main_loop:
	while(user_not_busy()) {
		if (!COMPAQ) sleep(sleep_time);     /* Part of our deal with Compaq */
		get_user_input();
		if (!DELL) sleep(sleep_time);      /* But we also did a deal with Dell */
		act_on_user_input();
		sleep(sleep_time);
	}

 
/* Some random events to keep the user on their toes */
	switch((rand()%10)+1) {
		case 1: sleep(sleep_time); break;
		case 2: sleep(sleep_time); break;
		case 3: beep();
			hang_system();
			break;
		case 4: sleep(sleep_time*2); break;
		case 5: create_invalid_page_fault();
			#ifdef _WINDOWS_NT_
				blue_screen_of_death();
			#endif
			break;
		case 6: sleep(sleep_time*rand()); break;
		case 7: /* Don't GPF in Win98, this is a "bug fix" */
			#ifndef _WINDOWS_98_
				create_general_protection_fault();
			#endif
			break;
		case 8: sleep(sleep_time); break;
		case 9: sleep(sleep_time); break;
		case 10: shutdown(); break;   /* for good measure */
	}

	goto main_loop;  /* best coding practices and all that */
}

Posted: Sun Jun 03, 2007 10:20 am
by GLneo

Code: Select all

#include 
#include 
#include  /* Microsoft Network Connectivity
                           library */
#include  /* For the court of law */

#define say(x) lie(x)
#define computeruser ALL_WANT_TO_BUY_OUR_BUGWARE 
#define next_year soon
#define the_product_is_ready_to_ship_another_beta_version

void main()
{
  if (latest_window_version>one_month_old)
  {
    if (there_are_still_bugs)
      market(bugfix);
    if (sales_drop_below_certain_point)
      raise(RUMOURS_ABOUT_A_NEW_BUGLESS_VERSION);
  }
  while(everyone_chats_about_new_version)
  {

make_false_promise(it_will_be_multitasking); 
                        /* Standard Call, in lie.h */
     if (rumours_grow_wilder)
       make_false_promise(it_will_be_plug_n_play);
     if (rumours_grow_even_wilder)
     {
       market_time=ripe;
       say("It will be ready in one month);
       order(programmers, stop_fixing_bugs_in_old_version);
       order(programmers, start_brainstorm_about_new_version);
       order(marketingstaff, permission_to_spread_nonsense);
       vapourware=TRUE;
       break;
      }
   }
   switch (nasty_questions_of_the_worldpress)
   {
    case WHEN_WILL_IT_BE_READY:
      say("It will be ready in", today+30_days," 
           we're just testing"); break;
    case WILL_THIS_PLUG_AND_PLAY_THING_WORK:
        say("Yes it will work");
        ask(programmers, why_does_it_not_work);
        pretend(there_is_no_problem);
        break;
     case WHAT_ARE_MINIMAL_HARDWARE_REQUIREMENTS:
        say("It will run on a 8086 with lightning speed due to"
            " the 32 bits architecture");
        inform(INTEL, "Pentium sales will rise skyhigh");
        inform(SAMSUNG, "Start a new memorychip plant"
            "'cos all those customers will need at least 32 megs");
        inform(QUANTUM, "Thanks to our fatware your
             sales will triple");        
        get_big_bonus(INTEL, SAMSUNG, QUANTUM); 
     break;
      case DOES_MICROSOFT_GET_TOO_MUCH_INFLUENCE:
        say("Oh no, we are just here to make a better world for
             everyone");
        register(journalist, Big_Bill_Book);
        when(time_is_ripe)
        {
          arrest(journalist);
          brainwash(journalist);
          when(journalist_says_windows95_is_bugfree)
          {
            order(journalist, "write a nice objective article");
            release (journalist);
          }
        }
        break;
    }
    while (vapourware)
    {
      introduction_date++; /* Delay */
      if (no_one_believes_anymore_there_will_be_a_release)
        break;
      say("It will be ready in",today+ONE_MONTH);
   }
   release(beta_version)
   while (everyone_is_dumb_enough_to_buy_our_bugware)
   {
     bills_bank_account += 150*megabucks;
     release(new_and_even_better_beta_version);
     introduce(more_memory_requirements);
     if (customers_report_installation_problems)
     {
       say("that is a hardware problem, not a software problem");
       if (smart_customer_says_but_you_promised_plug_and_play)
       {
         ignore(customer);
         order(microsoft_intelligence_agency, "Keep an eye on this
                                               bastard");
       }
     }
     if ( bills_bank_account>skyhigh && marriage>two_years )
     {
       divorce(woman_that_was_beatiful_when_I_married_her);
       wave(dollars, at_lusty_chicks);
       marry(young_blond_virgin_with_big_boobies);
       devirginize(young_blond_virgin_with_big_boobies);
       if (boobies_start_to_hang)

         dump(young_blond_virgin_with_big_boobies);
     }
     if (there_is_another_company)
     {
       steal(their_ideas);
       accuse(compagny, stealing_our_ideas);
       hire(a_lot_of_lawyers); /* in process.h */
       wait(until_other_company_cannot_afford_another_lawsuit);
       buy_out(other_company);
     }
   }
   /* Now everyone realizes that we sell bugware and
         they are all angry at us */
          order(plastic_surgeon, 
              make_bill_look_like_poor_bastard);
          buy(nice_little_island); hire(harem);
          laugh_at(everyone,
for_having_the_patience_year_after_year_for_another_unfinished_version);
 }

void bugfix(void)
{
   charge (a_lot_of_money)
   if (customer_says_he_does_not_want_to_pay_for_bugfix)
     say("It is not a bugfix but a new version");
   if (still_complaints)
   {
     ignore(customer);
     register(customer, big_Bill_book);
     /* We'll get him when everyone uses Billware!!*/
   }
}

Posted: Sun Jun 03, 2007 10:30 am
by earlz
you guys are idiots!
microsoft wouldn't use C, they use qbasic!!

lol..I don't even remember basic syntax stuff, so I can't make fun in my joke :( oh well..

Posted: Sun Jun 03, 2007 11:27 am
by Zacariaz
Pretty old, but still somewhat funny:
http://www.albinoblacksheep.com/flash/winrg.php

Posted: Sun Jun 03, 2007 11:53 am
by XCHG
Actually I have nothing against Windows. I don't know why but I really believe Windows is one of THE best Operating Systems. It has support for, uh, support for um it supports a lot of things and basically Windows comes with a lot of bonus stuff. I got a pack of macaroni and cheese in Windows XP package and I'm pretty happy about my purchase.

About the source code, I think we have to give Microsoft programmers a break. There are plenty of very good programmers working for MS. One of them happens to be my friend; his name is Kermit and he has written all the functions exported in Kernel32.dll as attached to this post.

Posted: Sun Jun 03, 2007 3:25 pm
by piranha
I think I can remember some basic..... lets see.....

Something like:

PRINT $Copyright
Call ScrewUpComputer
Call Crash
PRINT "You, user are an incompetent fool."
PRINT "Repairing Harddrive with scandisk..."
Call SearchAndDestroyNOTMICROSFT
Call Implant_Embedded_Virus 'This comes with Windows!
IF COMPUTER = OK THEN
Call Annoy_the_user_relentlessly
ELSE
DO
PRINT "A:"
Call GetInput
sleep 5 '5 sec to make it look like DOS is doing something
PRINT "CANNOT FIND PROGRAM, FILE OR BATCH FILE"
IF Get_Random_Number_From_One_To_Three = 2 THEN
Call Crash
End If
LOOP
END IF

Posted: Sun Jun 03, 2007 8:33 pm
by pcmattman
I had a feeling everyone would have opinions about my post...

I like the contributions :D

Posted: Sun Jun 03, 2007 11:29 pm
by AndrewAPrice
If you can prove you're part of IT faculty at a college, Microsoft will give you access to the Windows Research Kernel (a fancy branding for the latest Windows kernel along with full source code).

Posted: Sun Jun 03, 2007 11:33 pm
by pcmattman
MessiahAndrw wrote:If you can prove you're part of IT faculty at a college, Microsoft will give you access to the Windows Research Kernel (a fancy branding for the latest Windows kernel along with full source code).
Woah.

* Signs up for IT college faculty and crosses fingers *
* Once in, zips up code and posts it online *
* Hides away while the lawsuits run their course *
* Becomes an Open-Source hero! *

Posted: Sat Jul 07, 2007 10:32 pm
by dc0d32
well, this has happened :!:

dont tell anyone :P I've seen [you probably know what "seeing" means when an osdev says it] the windows 2000 source code [well not all, much of it, including kernel, IE, Windows media player and what not] :shock:
It was wandering over the e2dk p2p network, which a friend of mine downloaded.

I dint copy it to my HDD, because i feared M$ guys would track me down somehow :lol:

Posted: Sat Jul 07, 2007 10:43 pm
by Alboin
Why would you want it to begin with? :wink:

If you want to learn from an OS I would sway more towards Tanenbaum.

Posted: Sat Jul 07, 2007 10:57 pm
by earlz
I'd be curious as to some of the comments of it...

Code: Select all

...
/*MemoryCheck(); We gain 80ns per CD read without this, so disabled it*/
...

Posted: Sun Jul 08, 2007 1:44 am
by Colonel Kernel
Alboin wrote:Why would you want it to begin with? :wink:

If you want to learn from an OS I would sway more towards Tanenbaum.
No. Tanenbaum has a lot of great things to say about the theory of OS architecture, but the Minix code is total crap (at least 2.0 was -- I haven't looked at 3.0 yet). Search for some of the other threads where I've ranted about Tanenbaum... I don't feel like repeating myself too much right now. ;)

As for studying Windows, legal issues aside, I don't see anything wrong from learning about it on a technical level. Its VMS heritage is very interesting. For a non-microkernel (difficult to call it "monolithic" really) it's not bad. Or, if you think it's bad, study it and learn what not to do. ;)

Don't assume that you'll earn brownie points just by bashing Windows. As much as I hate to use it, it still has educational value for OS dev.