mirror of
https://github.com/reactos/reactos
synced 2025-10-07 17:02:50 +02:00
Compare commits
343 Commits
backups/pn
...
backups/po
Author | SHA1 | Date | |
---|---|---|---|
|
3a3d839af3 | ||
|
1928c25d73 | ||
|
18ac7f07b6 | ||
|
e8c40d4eee | ||
|
2160c0c245 | ||
|
5b43b8d8b1 | ||
|
8af30ee387 | ||
|
bf338a8003 | ||
|
3b57e224a1 | ||
|
4b4d215e36 | ||
|
725d5b0050 | ||
|
264ff7e6d2 | ||
|
8d6d8aaf57 | ||
|
d7b7ff3672 | ||
|
9ac6146c7b | ||
|
7909dfa511 | ||
|
702e2a0488 | ||
|
d6eec68dd8 | ||
|
5568b1261a | ||
|
ee219b0e23 | ||
|
37d076fdc0 | ||
|
4dd2fef625 | ||
|
a93d293fa7 | ||
|
101713f39a | ||
|
31d0c28c6d | ||
|
31390cae28 | ||
|
ffb29d1f85 | ||
|
0bc300d64d | ||
|
27a6253e6c | ||
|
7792b4bfea | ||
|
6ba7e5d2cd | ||
|
9da5e3306e | ||
|
377ffd2516 | ||
|
353f0bf39d | ||
|
932dc7e607 | ||
|
995ac8a5b2 | ||
|
a0ef12d39e | ||
|
77089de5b6 | ||
|
2200dc3562 | ||
|
68a209fb2b | ||
|
05c22b76ae | ||
|
c683236f8a | ||
|
cf1a2b10ac | ||
|
00c9609713 | ||
|
87aa47161b | ||
|
38de497b18 | ||
|
0c3c1a51b0 | ||
|
2607bc5f85 | ||
|
096c2a1089 | ||
|
645c3e7497 | ||
|
08807e03af | ||
|
e2e4bed006 | ||
|
88e83d47c5 | ||
|
b3dee30733 | ||
|
aeac4dceb8 | ||
|
eb5d74fe5e | ||
|
9c23880fd4 | ||
|
0331e3dfe8 | ||
|
58f9a46b3e | ||
|
6e2aa454ad | ||
|
5817ae7a54 | ||
|
db6c8885b6 | ||
|
c614ba1a5e | ||
|
610dd8e8bc | ||
|
6733de66c9 | ||
|
c030bd043b | ||
|
5845a581f2 | ||
|
5da996d016 | ||
|
234a011028 | ||
|
2b66d8f4fb | ||
|
9cafa059bd | ||
|
6829bd8c8b | ||
|
f4d2ac0b1e | ||
|
781c6b374f | ||
|
7740536c18 | ||
|
a9920ccd9d | ||
|
30e7e912c2 | ||
|
631838f4a3 | ||
|
e0dda3685a | ||
|
c9a0b04418 | ||
|
3e18dad277 | ||
|
ddc52fc76c | ||
|
45d0cf852c | ||
|
d4449cd58d | ||
|
8c8090fc65 | ||
|
99bd564c01 | ||
|
4c0e95ce09 | ||
|
aa0b005b38 | ||
|
24b6532712 | ||
|
f4c3dd909b | ||
|
0ed727c9f8 | ||
|
d70abfc25b | ||
|
39ef71436d | ||
|
9d6033ebad | ||
|
88594a14de | ||
|
f5129193e2 | ||
|
5942162766 | ||
|
837c3298c7 | ||
|
887849790a | ||
|
58096a81e6 | ||
|
1eb9c1db51 | ||
|
91ec410e2f | ||
|
1a1051e787 | ||
|
9a53101c31 | ||
|
fc68dda45d | ||
|
df118afc6f | ||
|
956f376f4f | ||
|
3e3c9e9775 | ||
|
34eabf82b5 | ||
|
b47adbe03f | ||
|
adcb1f9fef | ||
|
3d7368e673 | ||
|
c6c92ec896 | ||
|
33bd174f16 | ||
|
a4ca03679f | ||
|
3b6c6f0a94 | ||
|
b9df1e262e | ||
|
abe286b572 | ||
|
d91b173cb3 | ||
|
1df2f8903a | ||
|
b27e166698 | ||
|
95cdf6e471 | ||
|
63e93fb6ba | ||
|
c568ca436d | ||
|
40c9a57fa2 | ||
|
9a3b51ea9a | ||
|
e70a05cabf | ||
|
abd513250f | ||
|
4b77a4d92d | ||
|
298503a6e4 | ||
|
093d9f292c | ||
|
7af94c863d | ||
|
d34cc750d8 | ||
|
9166ff8f34 | ||
|
7bbf6258d7 | ||
|
810d009783 | ||
|
c1a2f01875 | ||
|
0ba6cce82a | ||
|
85197737c3 | ||
|
a6e0f1b9c1 | ||
|
e45867b698 | ||
|
56ec91131c | ||
|
b94afd8f6e | ||
|
a16cc05ef2 | ||
|
cc161feeb5 | ||
|
c9481ea29c | ||
|
2663d38106 | ||
|
71160a6cae | ||
|
d36e7a745d | ||
|
56f3c4ed58 | ||
|
b1cf1bfa05 | ||
|
52c1eca7aa | ||
|
3985d6c980 | ||
|
a16ba46cd2 | ||
|
02d3095664 | ||
|
6256db0836 | ||
|
366a70a52a | ||
|
322cd3e113 | ||
|
c5ccc1106a | ||
|
a6bdb724d0 | ||
|
c6237266d7 | ||
|
2cb97d1370 | ||
|
601ea5384b | ||
|
18cff7ccc9 | ||
|
dac8f53fe5 | ||
|
d57bccaddf | ||
|
c0282425ac | ||
|
e2303991a6 | ||
|
034bf04901 | ||
|
bdd0224945 | ||
|
2acf2098b8 | ||
|
b995b11c1d | ||
|
98b6f6bd7b | ||
|
68c2c91476 | ||
|
237d12dc8e | ||
|
95a75efe29 | ||
|
cf7a330bf0 | ||
|
b8442ebcdd | ||
|
2cec8d9d65 | ||
|
b82483c76c | ||
|
7b78b8092c | ||
|
bbba49d610 | ||
|
16290c9195 | ||
|
49388de0ac | ||
|
c773a28861 | ||
|
bd3a9da15f | ||
|
ff86185830 | ||
|
1cb1df84c1 | ||
|
8a7c057498 | ||
|
d3ab2ca78a | ||
|
353bc6197c | ||
|
c6779bb5c2 | ||
|
785882957e | ||
|
80eabf0040 | ||
|
1a0cac4ee8 | ||
|
e1d5086ebf | ||
|
2177dfcfd2 | ||
|
47632d3088 | ||
|
f477aa0a0f | ||
|
849f32b6b5 | ||
|
f165c00432 | ||
|
13027a8afa | ||
|
cb76d1fab2 | ||
|
e26cc4962b | ||
|
04bbda156c | ||
|
f4a430511e | ||
|
1844746db4 | ||
|
e0dfaf1c5b | ||
|
d9bef42fde | ||
|
ff0ad6c8cb | ||
|
6514e33a95 | ||
|
ad17913046 | ||
|
aed77eddbd | ||
|
be04afc103 | ||
|
f22d019858 | ||
|
4e0cf9abb6 | ||
|
a9f4f32734 | ||
|
af2755d461 | ||
|
2f4cc70e0f | ||
|
7f6485630b | ||
|
938d6d1baf | ||
|
d840ae26ad | ||
|
b01de1ffd4 | ||
|
359d3bc253 | ||
|
315c267eef | ||
|
32fce0a991 | ||
|
e56e6b57c7 | ||
|
1e7d27e8c9 | ||
|
2c4319bbb7 | ||
|
3acecc6fd4 | ||
|
70ccaeb797 | ||
|
cc05ff6eb8 | ||
|
93ccc29d64 | ||
|
0f301d785a | ||
|
ff278d3830 | ||
|
8a17f1f08d | ||
|
2f69ef0ae5 | ||
|
38024cdd26 | ||
|
275c59c4d4 | ||
|
fccdd32ffd | ||
|
7e355fdee2 | ||
|
b82d7998fa | ||
|
c5fcba3366 | ||
|
d5c7b7443b | ||
|
23ffe8c3f8 | ||
|
87c424ef42 | ||
|
ce4cbf5e57 | ||
|
11fe38608b | ||
|
c5c1a87719 | ||
|
45ba821ec5 | ||
|
5875f60018 | ||
|
afa13639b8 | ||
|
f8ec26b8ae | ||
|
95daa63b61 | ||
|
c8e0c8df83 | ||
|
450aa4ce11 | ||
|
8b21b47868 | ||
|
e231640a15 | ||
|
8e401adc6b | ||
|
e31b75dfe5 | ||
|
7bf6af0dce | ||
|
de83dfa5b8 | ||
|
4ea628ccaa | ||
|
fc9d1af415 | ||
|
af98825fd6 | ||
|
a8708688d2 | ||
|
671ba3795b | ||
|
5ca5fa5dd7 | ||
|
dee9cfe25c | ||
|
0cd3294365 | ||
|
ed14a2c656 | ||
|
6edcaa7b93 | ||
|
ca512a7b11 | ||
|
ce23c3c042 | ||
|
8cd95a438b | ||
|
5696ea2bc9 | ||
|
a9bcd9387d | ||
|
fd0f414659 | ||
|
0b60acbc3c | ||
|
8a147bd7bb | ||
|
0699457c1d | ||
|
346e718bc8 | ||
|
3a1a462a26 | ||
|
c0212e2720 | ||
|
7df5d3e7e1 | ||
|
5b6820630a | ||
|
eeabdc3329 | ||
|
3d737b9d74 | ||
|
91203bfc8d | ||
|
97db1efac1 | ||
|
fd13cf7e83 | ||
|
8df3d41437 | ||
|
1d13fa9747 | ||
|
6f4ae1108e | ||
|
4069692f64 | ||
|
c1442ae332 | ||
|
9ad486dd0a | ||
|
911b9d27ae | ||
|
7c238e511f | ||
|
dea5b1d43f | ||
|
0c492c87b9 | ||
|
29937a5a8c | ||
|
f9764318f4 | ||
|
7189768d70 | ||
|
a48a01798c | ||
|
9b5646acd0 | ||
|
a57d7a6f93 | ||
|
16b0e06b8f | ||
|
ea49ca93dd | ||
|
e7986f168f | ||
|
903225f24e | ||
|
4d27307543 | ||
|
713139d9ea | ||
|
d295d5da57 | ||
|
f3fc2ca494 | ||
|
9b8f8ea446 | ||
|
f9a85ac5fb | ||
|
8030aa9a2c | ||
|
fe96ab9edf | ||
|
628501e0ac | ||
|
bcfaaaf65b | ||
|
0607c67b68 | ||
|
03a5f16ed9 | ||
|
0baf2d03b1 | ||
|
761a68acf7 | ||
|
154128c1a0 | ||
|
cd0596ffa4 | ||
|
742ddb108f | ||
|
f39737088b | ||
|
577b88645b | ||
|
fce0440b32 | ||
|
f0e7b26df9 | ||
|
5f113d7735 | ||
|
e332bc75f9 | ||
|
212b767a54 | ||
|
0a9a6b6359 | ||
|
4d4ec75256 | ||
|
fde9c768e4 | ||
|
b0c5a68699 | ||
|
5b1f9c5705 | ||
|
b4e10fa87d | ||
|
a24101498d | ||
|
3210fa3a76 |
@@ -9,59 +9,118 @@
|
||||
|
||||
#include "File.h"
|
||||
#include "ssprintf.h"
|
||||
#include "trim.h"
|
||||
|
||||
#include "IRCClient.h"
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
const char* ArchBlackmann = "ArchBlackmann";
|
||||
#if defined(_DEBUG) && 0
|
||||
const char* BOTNAME = "RoyBot";
|
||||
const char* CHANNEL = "#RoyBotTest";
|
||||
#else
|
||||
const char* BOTNAME = "ArchBlackmann";
|
||||
const char* CHANNEL = "#ReactOS";
|
||||
#endif
|
||||
|
||||
vector<string> tech, module, dev, stru, period;
|
||||
//vector<string> tech, module, dev, stru, period, status, type, func, irql, curse, cursecop;
|
||||
|
||||
void ImportList ( vector<string>& list, const char* filename )
|
||||
class List
|
||||
{
|
||||
File f ( filename, "r" );
|
||||
public:
|
||||
string name;
|
||||
bool macro;
|
||||
std::vector<std::string> list;
|
||||
string tag;
|
||||
int last;
|
||||
List() { last = -1; }
|
||||
List ( const char* _name, bool _macro ) : name(_name), macro(_macro)
|
||||
{
|
||||
tag = ssprintf("%%%s%%",_name);
|
||||
last = -1;
|
||||
}
|
||||
};
|
||||
|
||||
vector<List> lists;
|
||||
vector<string> ops;
|
||||
|
||||
void ImportList ( const char* listname, bool macro )
|
||||
{
|
||||
lists.push_back ( List ( listname, macro ) );
|
||||
List& list = lists.back();
|
||||
File f ( ssprintf("%s.txt",listname).c_str(), "r" );
|
||||
string line;
|
||||
while ( f.next_line ( line, true ) )
|
||||
list.push_back ( line );
|
||||
list.list.push_back ( line );
|
||||
}
|
||||
|
||||
const char* ListRand ( const vector<string>& list )
|
||||
const char* ListRand ( List& list )
|
||||
{
|
||||
return list[rand()%list.size()].c_str();
|
||||
vector<string>& l = list.list;
|
||||
if ( !l.size() )
|
||||
{
|
||||
static string nothing;
|
||||
nothing = ssprintf ( "<list '%s' empty>", list.name.c_str() );
|
||||
return nothing.c_str();
|
||||
}
|
||||
else if ( l.size() == 1 )
|
||||
return l[0].c_str();
|
||||
int sel = list.last;
|
||||
while ( sel == list.last )
|
||||
sel = rand()%l.size();
|
||||
list.last = sel;
|
||||
return l[sel].c_str();
|
||||
}
|
||||
|
||||
string TechReply()
|
||||
const char* ListRand ( int i )
|
||||
{
|
||||
string t = ListRand(tech);
|
||||
return ListRand ( lists[i] );
|
||||
}
|
||||
|
||||
int GetListIndex ( const char* listname )
|
||||
{
|
||||
for ( int i = 0; i < lists.size(); i++ )
|
||||
{
|
||||
if ( !stricmp ( lists[i].name.c_str(), listname ) )
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
List& GetList ( const char* listname )
|
||||
{
|
||||
return lists[GetListIndex(listname)];
|
||||
}
|
||||
|
||||
const char* ListRand ( const char* list )
|
||||
{
|
||||
int i = GetListIndex ( list );
|
||||
if ( i < 0 )
|
||||
return NULL;
|
||||
return ListRand(i);
|
||||
}
|
||||
|
||||
string TaggedReply ( const char* listname )
|
||||
{
|
||||
string t = ListRand(listname);
|
||||
string out;
|
||||
const char* p = t.c_str();
|
||||
while ( *p )
|
||||
{
|
||||
if ( *p == '%' )
|
||||
{
|
||||
if ( !strnicmp ( p, "%dev%", 5 ) )
|
||||
bool found = false;
|
||||
for ( int i = 0; i < lists.size() && !found; i++ )
|
||||
{
|
||||
out += ListRand(dev);
|
||||
p += 5;
|
||||
if ( lists[i].macro && !strnicmp ( p, lists[i].tag.c_str(), lists[i].tag.size() ) )
|
||||
{
|
||||
out += ListRand(i);
|
||||
p += lists[i].tag.size();
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
else if ( !strnicmp ( p, "%period%", 8 ) )
|
||||
{
|
||||
out += ListRand(period);
|
||||
p += 8;
|
||||
}
|
||||
else if ( !strnicmp ( p, "%module%", 8 ) )
|
||||
{
|
||||
out += ListRand(module);
|
||||
p += 8;
|
||||
}
|
||||
else if ( !strnicmp ( p, "%stru%", 6 ) )
|
||||
{
|
||||
out += ListRand(stru);
|
||||
p += 6;
|
||||
}
|
||||
else
|
||||
if ( !found )
|
||||
out += *p++;
|
||||
}
|
||||
const char* p2 = strchr ( p, '%' );
|
||||
@@ -76,6 +135,28 @@ string TechReply()
|
||||
return out;
|
||||
}
|
||||
|
||||
string gobble ( string& s, const char* delim )
|
||||
{
|
||||
const char* p = s.c_str();
|
||||
p += strspn ( p, delim );
|
||||
const char* p2 = strpbrk ( p, delim );
|
||||
if ( !p2 ) p2 = p + strlen(p);
|
||||
string out ( p, p2-p );
|
||||
p2 += strspn ( p2, delim );
|
||||
s = string ( p2 );
|
||||
return out;
|
||||
}
|
||||
|
||||
bool isop ( const string& who )
|
||||
{
|
||||
for ( int i = 0; i < ops.size(); i++ )
|
||||
{
|
||||
if ( ops[i] == who )
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// do custom stuff with the IRCClient from your subclass via the provided callbacks...
|
||||
class MyIRCClient : public IRCClient
|
||||
{
|
||||
@@ -92,6 +173,32 @@ public:
|
||||
}
|
||||
bool OnJoin ( const string& user, const string& channel )
|
||||
{
|
||||
printf ( "user '%s' joined channel '%s'\n", user.c_str(), channel.c_str() );
|
||||
return true;
|
||||
}
|
||||
bool OnPart ( const std::string& user, const std::string& channel )
|
||||
{
|
||||
for ( int i = 0; i < ops.size(); i++ )
|
||||
{
|
||||
if ( ops[i] == user )
|
||||
{
|
||||
printf ( "remove '%s' to ops list\n", user.c_str() );
|
||||
ops.erase ( &ops[i] );
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
bool OnNick ( const std::string& oldNick, const std::string& newNick )
|
||||
{
|
||||
for ( int i = 0; i < ops.size(); i++ )
|
||||
{
|
||||
if ( ops[i] == oldNick )
|
||||
{
|
||||
printf ( "op '%s' changed nick to '%s'\n", oldNick.c_str(), newNick.c_str() );
|
||||
ops[i] = newNick;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
bool OnEndChannelUsers ( const string& channel )
|
||||
@@ -102,19 +209,168 @@ public:
|
||||
{
|
||||
printf ( "<%s> %s\n", from.c_str(), text.c_str() );
|
||||
flog.printf ( "<%s> %s\n", from.c_str(), text.c_str() );
|
||||
return PrivMsg ( from, "hey, your tongue doesn't belong there!" );
|
||||
if ( strnicmp ( text.c_str(), "!say ", 5 ) || !isop(from) )
|
||||
return PrivMsg ( from, "hey, your tongue doesn't belong there!" );
|
||||
string say = trim(&text[5]);
|
||||
if ( !strnicmp ( say.c_str(), "/me ", 4 ) )
|
||||
return Action ( CHANNEL, trim(&say[4]) );
|
||||
else
|
||||
return PrivMsg ( CHANNEL, trim(say) );
|
||||
}
|
||||
bool OnChannelMsg ( const string& channel, const string& from, const string& text )
|
||||
{
|
||||
printf ( "%s <%s> %s\n", channel.c_str(), from.c_str(), text.c_str() );
|
||||
flog.printf ( "%s <%s> %s\n", channel.c_str(), from.c_str(), text.c_str() );
|
||||
string text2(text);
|
||||
bool found_name = false;
|
||||
string text2 ( text );
|
||||
strlwr ( &text2[0] );
|
||||
if ( !strnicmp ( text2.c_str(), ArchBlackmann, strlen(ArchBlackmann) ) )
|
||||
|
||||
if ( !strnicmp ( text.c_str(), BOTNAME, strlen(BOTNAME) ) )
|
||||
found_name = true;
|
||||
else if ( !strnicmp ( text.c_str(), "arch ", 5 ) )
|
||||
found_name = true;
|
||||
|
||||
if ( found_name )
|
||||
{
|
||||
string reply = ssprintf("%s: %s", from.c_str(), TechReply().c_str());
|
||||
flog.printf ( "TECH-REPLY: %s\n", reply.c_str() );
|
||||
return PrivMsg ( channel, reply );
|
||||
string s ( text );
|
||||
gobble ( s, " \t" ); // remove bot name
|
||||
found_name = true;
|
||||
if ( s[0] == '!' )
|
||||
{
|
||||
bool from_op = isop(from);
|
||||
string cmd = gobble ( s, " \t" );
|
||||
if ( !from_op )
|
||||
{
|
||||
if ( cmd == "!grovel" )
|
||||
{
|
||||
string out = ssprintf(TaggedReply("nogrovel").c_str(),from.c_str());
|
||||
if ( !strnicmp ( out.c_str(), "/me ", 4 ) )
|
||||
return Action ( channel, &out[4] );
|
||||
else
|
||||
return PrivMsg ( channel, out );
|
||||
}
|
||||
return PrivMsg ( channel, ssprintf("%s: I don't take commands from non-ops",from.c_str()) );
|
||||
}
|
||||
if ( cmd == "!add" )
|
||||
{
|
||||
string listname = gobble ( s, " \t" );
|
||||
int i = GetListIndex ( listname.c_str() );
|
||||
if ( i == -1 )
|
||||
return PrivMsg ( channel, ssprintf("%s: I don't have a list named '%s'",from.c_str(),listname.c_str()) );
|
||||
List& list = lists[i];
|
||||
if ( s[0] == '\"' || s[0] == '\'' )
|
||||
{
|
||||
char delim = s[0];
|
||||
const char* p = &s[1];
|
||||
const char* p2 = strchr ( p, delim );
|
||||
if ( !p2 )
|
||||
return PrivMsg ( channel, ssprintf("%s: Couldn't add, unmatched quotes",from.c_str()) );
|
||||
s = string ( p, p2-p );
|
||||
}
|
||||
for ( i = 0; i < list.list.size(); i++ )
|
||||
{
|
||||
if ( list.list[i] == s )
|
||||
return PrivMsg ( channel, ssprintf("%s: entry already exists in list '%s'",from.c_str(),listname.c_str()) );
|
||||
}
|
||||
if ( !stricmp ( listname.c_str(), "curse" ) )
|
||||
strlwr ( &s[0] );
|
||||
list.list.push_back ( s );
|
||||
{
|
||||
File f ( ssprintf("%s.txt",list.name.c_str()), "w" );
|
||||
for ( i = 0; i < list.list.size(); i++ )
|
||||
f.printf ( "%s\n", list.list[i].c_str() );
|
||||
}
|
||||
return PrivMsg ( channel, ssprintf("%s: entry added to list '%s'",from.c_str(),listname.c_str()) );
|
||||
}
|
||||
else if ( cmd == "!remove" )
|
||||
{
|
||||
string listname = gobble ( s, " \t" );
|
||||
int i = GetListIndex ( listname.c_str() );
|
||||
if ( i == -1 )
|
||||
return PrivMsg ( channel, ssprintf("%s: I don't have a list named '%s'",from.c_str(),listname.c_str()) );
|
||||
List& list = lists[i];
|
||||
if ( s[0] == '\"' || s[0] == '\'' )
|
||||
{
|
||||
char delim = s[0];
|
||||
const char* p = &s[1];
|
||||
const char* p2 = strchr ( p, delim );
|
||||
if ( !p2 )
|
||||
return PrivMsg ( channel, ssprintf("%s: Couldn't add, unmatched quotes",from.c_str()) );
|
||||
s = string ( p, p2-p );
|
||||
}
|
||||
for ( i = 0; i < list.list.size(); i++ )
|
||||
{
|
||||
if ( list.list[i] == s )
|
||||
{
|
||||
list.list.erase ( &list.list[i] );
|
||||
{
|
||||
File f ( ssprintf("%s.txt",list.name.c_str()), "w" );
|
||||
for ( i = 0; i < list.list.size(); i++ )
|
||||
f.printf ( "%s\n", list.list[i].c_str() );
|
||||
}
|
||||
return PrivMsg ( channel, ssprintf("%s: entry removed from list '%s'",from.c_str(),listname.c_str()) );
|
||||
}
|
||||
}
|
||||
return PrivMsg ( channel, ssprintf("%s: entry doesn't exist in list '%s'",from.c_str(),listname.c_str()) );
|
||||
}
|
||||
else if ( cmd == "!grovel" )
|
||||
{
|
||||
string out = ssprintf(TaggedReply("grovel").c_str(),from.c_str());
|
||||
if ( !strnicmp ( out.c_str(), "/me ", 4 ) )
|
||||
return Action ( channel, &out[4] );
|
||||
else
|
||||
return PrivMsg ( channel, out );
|
||||
}
|
||||
else if ( cmd == "!kiss" )
|
||||
{
|
||||
if ( s.size() )
|
||||
return Action ( channel, ssprintf("kisses %s",s.c_str()) );
|
||||
else
|
||||
return PrivMsg ( channel, ssprintf("%s: huh?",from.c_str()) );
|
||||
}
|
||||
else if ( cmd == "!hug" )
|
||||
{
|
||||
if ( s.size() )
|
||||
return Action ( channel, ssprintf("hugs %s",s.c_str()) );
|
||||
else
|
||||
return PrivMsg ( channel, ssprintf("%s: huh?",from.c_str()) );
|
||||
}
|
||||
else if ( cmd == "!give" )
|
||||
{
|
||||
string who = gobble(s," \t");
|
||||
if ( who.size() && s.size() )
|
||||
return Action ( channel, ssprintf("gives %s a %s",who.c_str(),s.c_str()) );
|
||||
else
|
||||
return PrivMsg ( channel, ssprintf("%s: huh?",from.c_str()) );
|
||||
}
|
||||
else
|
||||
{
|
||||
return PrivMsg ( channel, ssprintf("%s: huh?",from.c_str()) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool found_curse = false;
|
||||
static vector<string>& curse = GetList("curse").list;
|
||||
text2 = ssprintf(" %s ",text2.c_str());
|
||||
for ( int i = 0; i < curse.size() && !found_curse; i++ )
|
||||
{
|
||||
if ( strstr ( text2.c_str(), curse[i].c_str() ) )
|
||||
found_curse = true;
|
||||
}
|
||||
if ( found_curse )
|
||||
{
|
||||
static List& cursecop = GetList("cursecop");
|
||||
return PrivMsg ( channel, ssprintf("%s: %s", from.c_str(), ListRand(cursecop)) );
|
||||
}
|
||||
else if ( found_name )
|
||||
{
|
||||
string out = ssprintf("%s: %s", from.c_str(), TaggedReply("tech").c_str());
|
||||
flog.printf ( "TECH-REPLY: %s\n", out.c_str() );
|
||||
if ( !strnicmp ( out.c_str(), "/me ", 4 ) )
|
||||
return Action ( channel, &out[4] );
|
||||
else
|
||||
return PrivMsg ( channel, out );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -123,9 +379,45 @@ public:
|
||||
//printf ( "OnChannelMode(%s,%s)\n", channel.c_str(), mode.c_str() );
|
||||
return true;
|
||||
}
|
||||
bool OnUserModeInChannel ( const string& src, const string& channel, const string& user, const string& mode )
|
||||
bool OnUserModeInChannel ( const string& src, const string& channel, const string& mode, const string& target )
|
||||
{
|
||||
//printf ( "OnUserModeInChannel(%s,%s%s,%s)\n", src.c_str(), channel.c_str(), user.c_str(), mode.c_str() );
|
||||
printf ( "OnUserModeInChannel(%s,%s,%s,%s)\n", src.c_str(), channel.c_str(), mode.c_str(), target.c_str() );
|
||||
const char* p = mode.c_str();
|
||||
if ( !p )
|
||||
return true;
|
||||
while ( *p )
|
||||
{
|
||||
switch ( *p++ )
|
||||
{
|
||||
case '+':
|
||||
while ( *p != 0 && *p != ' ' )
|
||||
{
|
||||
if ( *p == 'o' )
|
||||
{
|
||||
printf ( "adding '%s' to ops list\n", target.c_str() );
|
||||
ops.push_back ( target );
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case '-':
|
||||
while ( *p != 0 && *p != ' ' )
|
||||
{
|
||||
if ( *p == 'o' )
|
||||
{
|
||||
for ( int i = 0; i < ops.size(); i++ )
|
||||
{
|
||||
if ( ops[i] == target )
|
||||
{
|
||||
printf ( "remove '%s' to ops list\n", target.c_str() );
|
||||
ops.erase ( &ops[i] );
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
bool OnMode ( const string& user, const string& mode )
|
||||
@@ -135,14 +427,16 @@ public:
|
||||
}
|
||||
bool OnChannelUsers ( const string& channel, const vector<string>& users )
|
||||
{
|
||||
printf ( "[%s has %i users]: ", channel.c_str(), users.size() );
|
||||
//printf ( "[%s has %i users]: ", channel.c_str(), users.size() );
|
||||
for ( int i = 0; i < users.size(); i++ )
|
||||
{
|
||||
if ( i )
|
||||
if ( users[i][0] == '@' )
|
||||
ops.push_back ( &users[i][1] );
|
||||
/*if ( i )
|
||||
printf ( ", " );
|
||||
printf ( "%s", users[i].c_str() );
|
||||
printf ( "%s", users[i].c_str() );*/
|
||||
}
|
||||
printf ( "\n" );
|
||||
//printf ( "\n" );
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -150,32 +444,50 @@ public:
|
||||
int main ( int argc, char** argv )
|
||||
{
|
||||
srand ( time(NULL) );
|
||||
ImportList ( tech, "tech.txt" );
|
||||
ImportList ( stru, "stru.txt" );
|
||||
ImportList ( dev, "dev.txt" );
|
||||
ImportList ( period, "period.txt" );
|
||||
ImportList ( module, "module.txt" );
|
||||
|
||||
ImportList ( "dev", true );
|
||||
ImportList ( "func", true );
|
||||
ImportList ( "dev", true );
|
||||
ImportList ( "func", true );
|
||||
ImportList ( "irql", true );
|
||||
ImportList ( "module", true );
|
||||
ImportList ( "period", true );
|
||||
ImportList ( "status", true );
|
||||
ImportList ( "stru", true );
|
||||
ImportList ( "type", true );
|
||||
|
||||
ImportList ( "tech", false );
|
||||
ImportList ( "curse", false );
|
||||
ImportList ( "cursecop", false );
|
||||
ImportList ( "grovel", false );
|
||||
ImportList ( "nogrovel", false );
|
||||
|
||||
#ifdef _DEBUG
|
||||
printf ( "initializing IRCClient debugging\n" );
|
||||
IRCClient::SetDebug ( true );
|
||||
#endif//_DEBUG
|
||||
printf ( "calling suStartup()\n" );
|
||||
suStartup();
|
||||
printf ( "creating IRCClient object\n" );
|
||||
MyIRCClient irc;
|
||||
printf ( "connecting to freenode\n" );
|
||||
if ( !irc.Connect ( "212.204.214.114" ) ) // irc.freenode.net
|
||||
|
||||
//const char* server = "212.204.214.114";
|
||||
const char* server = "irc.freenode.net";
|
||||
|
||||
if ( !irc.Connect ( server ) ) // irc.freenode.net
|
||||
{
|
||||
printf ( "couldn't connect to server\n" );
|
||||
return -1;
|
||||
}
|
||||
printf ( "sending user command\n" );
|
||||
if ( !irc.User ( "ArchBlackmann", "", "irc.freenode.net", "Arch Blackmann" ) )
|
||||
if ( !irc.User ( BOTNAME, "", "irc.freenode.net", BOTNAME ) )
|
||||
{
|
||||
printf ( "USER command failed\n" );
|
||||
return -1;
|
||||
}
|
||||
printf ( "sending nick\n" );
|
||||
if ( !irc.Nick ( "ArchBlackmann" ) )
|
||||
if ( !irc.Nick ( BOTNAME ) )
|
||||
{
|
||||
printf ( "NICK command failed\n" );
|
||||
return -1;
|
||||
@@ -186,8 +498,8 @@ int main ( int argc, char** argv )
|
||||
printf ( "MODE command failed\n" );
|
||||
return -1;
|
||||
}
|
||||
printf ( "joining #ReactOS\n" );
|
||||
if ( !irc.Join ( "#ReactOS" ) )
|
||||
printf ( "joining channel\n" );
|
||||
if ( !irc.Join ( CHANNEL ) )
|
||||
{
|
||||
printf ( "JOIN command failed\n" );
|
||||
return -1;
|
||||
|
@@ -81,7 +81,13 @@ IRCClient::Join ( const string& channel )
|
||||
bool
|
||||
IRCClient::PrivMsg ( const string& to, const string& text )
|
||||
{
|
||||
return Send ( "PRIVMSG " + to + " :" + text + "\n" );
|
||||
return Send ( "PRIVMSG " + to + " :" + text + '\n' );
|
||||
}
|
||||
|
||||
bool
|
||||
IRCClient::Action ( const string& to, const string& text )
|
||||
{
|
||||
return Send ( "PRIVMSG " + to + " :" + (char)1 + "ACTION " + text + (char)1 + '\n' );
|
||||
}
|
||||
|
||||
bool
|
||||
@@ -226,10 +232,41 @@ int IRCClient::Run ( bool launch_thread )
|
||||
printf ( "!!!:OnRecv failure 5 (PRIVMSG w/o target): %s", buf.c_str() );
|
||||
continue;
|
||||
}
|
||||
if ( tgt[0] == '#' )
|
||||
OnChannelMsg ( tgt, src, text );
|
||||
if ( *p == 1 )
|
||||
{
|
||||
p++;
|
||||
p2 = strchr ( p, ' ' );
|
||||
if ( !p2 ) p2 = p + strlen(p);
|
||||
cmd = string ( p, p2-p );
|
||||
strlwr ( &cmd[0] );
|
||||
p = p2 + 1;
|
||||
p2 = strchr ( p, 1 );
|
||||
if ( !p2 )
|
||||
{
|
||||
printf ( "!!!:OnRecv failure 6 (no terminating \x01 for initial \x01 found: %s", buf.c_str() );
|
||||
continue;
|
||||
}
|
||||
text = string ( p, p2-p );
|
||||
if ( cmd == "action" )
|
||||
{
|
||||
if ( tgt[0] == '#' )
|
||||
OnChannelAction ( tgt, src, text );
|
||||
else
|
||||
OnPrivAction ( src, text );
|
||||
}
|
||||
else
|
||||
{
|
||||
printf ( "!!!:OnRecv failure 7 (unrecognized \x01 command '%s': %s", cmd.c_str(), buf.c_str() );
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
OnPrivMsg ( src, text );
|
||||
{
|
||||
if ( tgt[0] == '#' )
|
||||
OnChannelMsg ( tgt, src, text );
|
||||
else
|
||||
OnPrivMsg ( src, text );
|
||||
}
|
||||
}
|
||||
else if ( cmd == "mode" )
|
||||
{
|
||||
@@ -237,22 +274,22 @@ int IRCClient::Run ( bool launch_thread )
|
||||
//printf ( "[MODE] src='%s' cmd='%s' tgt='%s' text='%s'", src.c_str(), cmd.c_str(), tgt.c_str(), text.c_str() );
|
||||
//OnMode (
|
||||
// self mode change:
|
||||
// [MODE] src=Relic3_14 cmd=mode tgt=Relic3_14 text=+i
|
||||
// [MODE] src=Nick cmd=mode tgt=Nick text=+i
|
||||
// channel mode change:
|
||||
// [MODE] src=Royce3 cmd=mode tgt=#Royce3 text=+o Relic3_14
|
||||
// [MODE] src=Nick cmd=mode tgt=#Channel text=+o Nick
|
||||
if ( tgt[0] == '#' )
|
||||
{
|
||||
p = text.c_str();
|
||||
p2 = strchr ( p, ' ' );
|
||||
if ( !p2 )
|
||||
OnChannelMode ( tgt, text );
|
||||
else
|
||||
if ( p2 && *p2 )
|
||||
{
|
||||
string user ( p, p2-p );
|
||||
string mode ( p, p2-p );
|
||||
p = p2 + 1;
|
||||
p += strspn ( p, " " );
|
||||
OnUserModeInChannel ( src, tgt, user, p );
|
||||
OnUserModeInChannel ( src, tgt, mode, trim(p) );
|
||||
}
|
||||
else
|
||||
OnChannelMode ( tgt, text );
|
||||
}
|
||||
else
|
||||
OnMode ( tgt, text );
|
||||
@@ -261,6 +298,14 @@ int IRCClient::Run ( bool launch_thread )
|
||||
{
|
||||
OnJoin ( src, text );
|
||||
}
|
||||
else if ( cmd == "part" )
|
||||
{
|
||||
OnPart ( src, text );
|
||||
}
|
||||
else if ( cmd == "nick" )
|
||||
{
|
||||
OnNick ( src, text );
|
||||
}
|
||||
else if ( isdigit(cmd[0]) )
|
||||
{
|
||||
int i = atoi(cmd.c_str());
|
||||
@@ -307,7 +352,13 @@ int IRCClient::Run ( bool launch_thread )
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( _debug ) printf ( "unrecognized ':' response: %s", buf.c_str() );
|
||||
if ( strstr ( buf.c_str(), "ACTION" ) )
|
||||
{
|
||||
printf ( "ACTION: " );
|
||||
for ( int i = 0; i < buf.size(); i++ )
|
||||
printf ( "%c(%xh)", buf[i], (unsigned)(unsigned char)buf[i] );
|
||||
}
|
||||
else if ( _debug ) printf ( "unrecognized ':' response: %s", buf.c_str() );
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@@ -48,6 +48,9 @@ public:
|
||||
// send message to someone or some channel
|
||||
bool PrivMsg ( const std::string& to, const std::string& text );
|
||||
|
||||
// send /me to someone or some channel
|
||||
bool Action ( const std::string& to, const std::string& text );
|
||||
|
||||
// leave a channel
|
||||
bool Part ( const std::string& channel, const std::string& text );
|
||||
|
||||
@@ -59,32 +62,45 @@ public:
|
||||
// OnConnected: you just successfully logged into irc server
|
||||
virtual bool OnConnected() = 0;
|
||||
|
||||
// OnJoin: you just successfully joined this channel
|
||||
virtual bool OnJoin ( const std::string& user, const std::string& channel ) = 0;
|
||||
virtual bool OnNick ( const std::string& oldNick, const std::string& newNick ) { return true; }
|
||||
|
||||
// OnJoin: someone just successfully joined a channel you are in ( also sent when you successfully join a channel )
|
||||
virtual bool OnJoin ( const std::string& user, const std::string& channel ) { return true; }
|
||||
|
||||
// OnPart: someone just left a channel you are in
|
||||
virtual bool OnPart ( const std::string& user, const std::string& channel ) { return true; }
|
||||
|
||||
// OnPrivMsg: you just received a private message from a user
|
||||
virtual bool OnPrivMsg ( const std::string& from, const std::string& text ) = 0;
|
||||
virtual bool OnPrivMsg ( const std::string& from, const std::string& text ) { return true; }
|
||||
|
||||
virtual bool OnPrivAction ( const std::string& from, const std::string& text ) { return true; }
|
||||
|
||||
// OnChannelMsg: you just received a chat line in a channel
|
||||
virtual bool OnChannelMsg ( const std::string& channel, const std::string& from,
|
||||
const std::string& text ) = 0;
|
||||
const std::string& text ) { return true; }
|
||||
|
||||
// OnChannelAction: you just received a "/me" line in a channel
|
||||
virtual bool OnChannelAction ( const std::string& channel, const std::string& from,
|
||||
const std::string& text ) { return true; }
|
||||
|
||||
// OnChannelMode: notification of a change of a channel's mode
|
||||
virtual bool OnChannelMode ( const std::string& channel, const std::string& mode ) = 0;
|
||||
virtual bool OnChannelMode ( const std::string& channel, const std::string& mode )
|
||||
{ return true; }
|
||||
|
||||
// OnUserModeInChannel: notification of a mode change of a user with respect to a channel.
|
||||
// f.ex.: this will be called when someone is oped in a channel.
|
||||
virtual bool OnUserModeInChannel ( const std::string& src, const std::string& channel,
|
||||
const std::string& user, const std::string& mode ) = 0;
|
||||
const std::string& mode, const std::string& target ) { return true; }
|
||||
|
||||
// OnMode: you will receive this when you change your own mode, at least...
|
||||
virtual bool OnMode ( const std::string& user, const std::string& mode ) = 0;
|
||||
virtual bool OnMode ( const std::string& user, const std::string& mode ) { return true; }
|
||||
|
||||
// notification of what users are in a channel ( you may get multiple of these... )
|
||||
virtual bool OnChannelUsers ( const std::string& channel, const std::vector<std::string>& users ) = 0;
|
||||
virtual bool OnChannelUsers ( const std::string& channel, const std::vector<std::string>& users )
|
||||
{ return true; }
|
||||
|
||||
// notification that you have received the entire list of users for a channel
|
||||
virtual bool OnEndChannelUsers ( const std::string& channel ) = 0;
|
||||
virtual bool OnEndChannelUsers ( const std::string& channel ) { return true; }
|
||||
|
||||
// OnPing - default implementation replies to PING with a valid PONG. required on some systems to
|
||||
// log in. Most systems require a response in order to stay connected, used to verify a client hasn't
|
||||
|
26
irc/ArchBlackmann/curse.txt
Normal file
26
irc/ArchBlackmann/curse.txt
Normal file
@@ -0,0 +1,26 @@
|
||||
shit
|
||||
fuck
|
||||
pussy
|
||||
ass
|
||||
ass-
|
||||
-ass
|
||||
dumbass
|
||||
jackass
|
||||
fatass
|
||||
asshole
|
||||
smartass
|
||||
cunt
|
||||
fucker
|
||||
bitch
|
||||
dick
|
||||
penile
|
||||
stfu
|
||||
omfg
|
||||
lmao
|
||||
ass.
|
||||
-ass.
|
||||
semprini
|
||||
goat.cx
|
||||
ekush
|
||||
akshor
|
||||
poop
|
10
irc/ArchBlackmann/cursecop.txt
Normal file
10
irc/ArchBlackmann/cursecop.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
You should have your mouth washed out with soap!
|
||||
This is a clean channel... please watch your language
|
||||
Please try to keep it clean
|
||||
Hey, there's children present ( I'm not even a year old yet! )
|
||||
Could you find a less-offensive way to express yourself, please?
|
||||
Such language :(
|
||||
Those aren't nice words to use
|
||||
Oh, my poor innocent ears :(
|
||||
Help! My mind is being corrupted!
|
||||
filthy mouths are not appreciated here
|
@@ -11,4 +11,5 @@ Exception
|
||||
blight_
|
||||
jimtabor
|
||||
mtempel
|
||||
Gge
|
||||
Gge
|
||||
Alex_Ionescu
|
||||
|
581
irc/ArchBlackmann/func.txt
Normal file
581
irc/ArchBlackmann/func.txt
Normal file
@@ -0,0 +1,581 @@
|
||||
BOOLEAN
|
||||
CcCanIWrite
|
||||
CcCopyRead
|
||||
CcCopyWrite
|
||||
CcDeferWrite
|
||||
CcFastCopyRead
|
||||
CcFastCopyWrite
|
||||
CcFlushCache
|
||||
CcGetDirtyPages
|
||||
CcGetFileObjectFromBcb
|
||||
CcGetFileObjectFromSectionPtrs
|
||||
CcGetFlushedValidData
|
||||
CcGetLsnForFileObject
|
||||
CcInitializeCacheMap
|
||||
CcIsThereDirtyData
|
||||
CcMapData
|
||||
CcMdlRead
|
||||
CcMdlReadComplete
|
||||
CcMdlWriteAbort
|
||||
CcMdlWriteComplete
|
||||
CcPinMappedData
|
||||
CcPinRead
|
||||
CcPrepareMdlWrite
|
||||
CcPreparePinWrite
|
||||
CcPurgeCacheSection
|
||||
CcRemapBcb
|
||||
CcRepinBcb
|
||||
CcScheduleReadAhead
|
||||
CcSetAdditionalCacheAttributes
|
||||
CcSetBcbOwnerPointer
|
||||
CcSetDirtyPageThreshold
|
||||
CcSetDirtyPinnedData
|
||||
CcSetFileSizes
|
||||
CcSetLogHandleForFile
|
||||
CcSetReadAheadGranularity
|
||||
CcUninitializeCacheMap
|
||||
CcUnpinData
|
||||
CcUnpinDataForThread
|
||||
CcUnpinRepinnedBcb
|
||||
CcWaitForCurrentLazyWriterActivity
|
||||
CcZeroData
|
||||
DbgLoadImageSymbols
|
||||
DbgQueryDebugFilterState
|
||||
DbgSetDebugFilterState
|
||||
EVENT_TYPE
|
||||
ExAcquireResourceExclusive
|
||||
ExAcquireResourceExclusiveLite
|
||||
ExAcquireResourceSharedLite
|
||||
ExAcquireSharedStarveExclusive
|
||||
ExAcquireSharedWaitForExclusive
|
||||
ExAllocateFromZone
|
||||
ExAllocatePool
|
||||
ExAllocatePoolWithQuota
|
||||
ExAllocatePoolWithQuotaTag
|
||||
ExAllocatePoolWithTag
|
||||
ExConvertExclusiveToSharedLite
|
||||
ExCreateCallback
|
||||
ExDeleteNPagedLookasideList
|
||||
ExDeletePagedLookasideList
|
||||
ExDeleteResource
|
||||
ExDeleteResourceLite
|
||||
ExDisableResourceBoostLite
|
||||
ExEnumHandleTable
|
||||
ExExtendZone
|
||||
ExFreePool
|
||||
ExGetCurrentProcessorCounts
|
||||
ExGetCurrentProcessorCpuUsage
|
||||
ExGetExclusiveWaiterCount
|
||||
ExGetPreviousMode
|
||||
ExGetSharedWaiterCount
|
||||
ExInitializeNPagedLookasideList
|
||||
ExInitializePagedLookasideList
|
||||
ExInitializeResource
|
||||
ExInitializeResourceLite
|
||||
ExInitializeZone
|
||||
ExInterlockedAddLargeInteger
|
||||
ExInterlockedAddUlong
|
||||
ExInterlockedDecrementLong
|
||||
ExInterlockedExchangeUlong
|
||||
ExInterlockedExtendZone
|
||||
ExInterlockedIncrementLong
|
||||
ExInterlockedInsertHeadList
|
||||
ExInterlockedInsertTailList
|
||||
ExInterlockedPopEntryList
|
||||
ExInterlockedPushEntryList
|
||||
ExInterlockedRemoveHeadList
|
||||
ExIsProcessorFeaturePresent
|
||||
ExIsResourceAcquiredExclusiveLite
|
||||
ExIsResourceAcquiredSharedLite
|
||||
ExLocalTimeToSystemTime
|
||||
ExNotifyCallback
|
||||
ExPostSystemEvent
|
||||
ExQueryPoolBlockSize
|
||||
ExQueueWorkItem
|
||||
ExRaiseAccessViolation
|
||||
ExRaiseDatatypeMisalignment
|
||||
ExRaiseException
|
||||
ExRaiseHardError
|
||||
ExRaiseStatus
|
||||
ExRegisterCallback
|
||||
ExReinitializeResourceLite
|
||||
ExReleaseResource
|
||||
ExReleaseResourceForThread
|
||||
ExReleaseResourceForThreadLite
|
||||
ExRosDumpPagedPoolByTag
|
||||
ExRosQueryPoolTag
|
||||
ExSetResourceOwnerPointer
|
||||
ExSetTimerResolution
|
||||
ExSystemExceptionFilter
|
||||
ExSystemTimeToLocalTime
|
||||
ExTryToAcquireResourceExclusiveLite
|
||||
ExUnregisterCallback
|
||||
ExUuidCreate
|
||||
ExVerifySuite
|
||||
FsRtlAcquireFileExclusive
|
||||
FsRtlAddMcbEntry
|
||||
FsRtlAddToTunnelCache
|
||||
FsRtlAllocateFileLock
|
||||
FsRtlAllocatePool
|
||||
FsRtlAllocatePoolWithQuota
|
||||
FsRtlAllocatePoolWithQuotaTag
|
||||
FsRtlAllocatePoolWithTag
|
||||
FsRtlAllocateResource
|
||||
FsRtlAreNamesEqual
|
||||
FsRtlBalanceReads
|
||||
FsRtlCheckLockForReadAccess
|
||||
FsRtlCheckLockForWriteAccess
|
||||
FsRtlCopyRead
|
||||
FsRtlCopyWrite
|
||||
FsRtlFastCheckLockForRead
|
||||
FsRtlFastCheckLockForWrite
|
||||
FsRtlFastUnlockAll
|
||||
FsRtlFastUnlockAllByKey
|
||||
FsRtlFastUnlockSingle
|
||||
FsRtlFindInTunnelCache
|
||||
FsRtlFreeFileLock
|
||||
FsRtlGetFileSize
|
||||
FsRtlGetNextFileLock
|
||||
FsRtlGetNextMcbEntry
|
||||
FsRtlIncrementCcFastReadNoWait
|
||||
FsRtlIncrementCcFastReadNotPossible
|
||||
FsRtlIncrementCcFastReadResourceMiss
|
||||
FsRtlIncrementCcFastReadWait
|
||||
FsRtlInitializeFileLock
|
||||
FsRtlInitializeMcb
|
||||
FsRtlInitializeTunnelCache
|
||||
FsRtlInsertPerFileObjectContext
|
||||
FsRtlInsertPerStreamContext
|
||||
FsRtlIsDbcsInExpression
|
||||
FsRtlIsFatDbcsLegal
|
||||
FsRtlIsHpfsDbcsLegal
|
||||
FsRtlIsNameInExpression
|
||||
FsRtlLookupLastLargeMcbEntryAndIndex
|
||||
FsRtlLookupLastMcbEntry
|
||||
FsRtlLookupMcbEntry
|
||||
FsRtlLookupPerFileObjectContext
|
||||
FsRtlLookupPerStreamContextInternal
|
||||
FsRtlMdlRead
|
||||
FsRtlMdlReadComplete
|
||||
FsRtlMdlReadCompleteDev
|
||||
FsRtlMdlReadDev
|
||||
FsRtlMdlWriteComplete
|
||||
FsRtlMdlWriteCompleteDev
|
||||
FsRtlNotifyChangeDirectory
|
||||
FsRtlNotifyCleanup
|
||||
FsRtlNotifyFilterChangeDirectory
|
||||
FsRtlNotifyFilterReportChange
|
||||
FsRtlNotifyFullChangeDirectory
|
||||
FsRtlNotifyFullReportChange
|
||||
FsRtlNotifyReportChange
|
||||
FsRtlNotifyUninitializeSync
|
||||
FsRtlNumberOfRunsInMcb
|
||||
FsRtlPostPagingFileStackOverflow
|
||||
FsRtlPostStackOverflow
|
||||
FsRtlPrepareMdlWrite
|
||||
FsRtlPrepareMdlWriteDev
|
||||
FsRtlPrivateLock
|
||||
FsRtlProcessFileLock
|
||||
FsRtlRegisterFileSystemFilterCallbacks
|
||||
FsRtlReleaseFile
|
||||
FsRtlRemoveMcbEntry
|
||||
FsRtlRemovePerFileObjectContext
|
||||
FsRtlRemovePerStreamContext
|
||||
FsRtlResetLargeMcb
|
||||
FsRtlSyncVolumes
|
||||
FsRtlTeardownPerStreamContexts
|
||||
FsRtlTruncateMcb
|
||||
FsRtlUninitializeFileLock
|
||||
FsRtlUninitializeMcb
|
||||
HalAdjustResourceList
|
||||
HalAllocateCommonBuffer
|
||||
HalAssignSlotResources
|
||||
HalCalibratePerformanceCounter
|
||||
HalFlushCommonBuffer
|
||||
HalFreeCommonBuffer
|
||||
HalGetAdapter
|
||||
HalGetBusData
|
||||
HalGetBusDataByOffset
|
||||
HalGetDmaAlignmentRequirement
|
||||
HalMakeBeep
|
||||
HalQueryDisplayParameters
|
||||
HalQueryRealTimeClock
|
||||
HalReadDmaCounter
|
||||
HalRequestIpi
|
||||
HalSetBusData
|
||||
HalSetBusDataByOffset
|
||||
HalSetDisplayParameters
|
||||
HalSetRealTimeClock
|
||||
HalStartNextProcessor
|
||||
IoAcquireCancelSpinLock
|
||||
IoAcquireRemoveLockEx
|
||||
IoAcquireVpbSpinLock
|
||||
IoAllocateAdapterChannel
|
||||
IoAllocateController
|
||||
IoAllocateDriverObjectExtension
|
||||
IoAllocateErrorLogEntry
|
||||
IoAllocateIrp
|
||||
IoAllocateMdl
|
||||
IoAllocateWorkItem
|
||||
IoAssignResources
|
||||
IoAttachDevice
|
||||
IoAttachDeviceByPointer
|
||||
IoAttachDeviceToDeviceStack
|
||||
IoAttachDeviceToDeviceStackSafe
|
||||
IoBuildAsynchronousFsdRequest
|
||||
IoBuildDeviceIoControlRequest
|
||||
IoBuildPartialMdl
|
||||
IoBuildSynchronousFsdRequest
|
||||
IoCallDriver
|
||||
IoCancelFileOpen
|
||||
IoCancelIrp
|
||||
IoCheckQuerySetFileInformation
|
||||
IoCheckQuerySetVolumeInformation
|
||||
IoCheckQuotaBufferValidity
|
||||
IoCheckShareAccess
|
||||
IoCompleteRequest
|
||||
IoConnectInterrupt
|
||||
IoCreateController
|
||||
IoCreateDevice
|
||||
IoCreateDisk
|
||||
IoCreateDriver
|
||||
IoCreateFile
|
||||
IoCreateFileSpecifyDeviceObjectHint
|
||||
IoCreateNotificationEvent
|
||||
IoCreateStreamFileObject
|
||||
IoCreateStreamFileObjectEx
|
||||
IoCreateStreamFileObjectLite
|
||||
IoCreateSymbolicLink
|
||||
IoCreateSynchronizationEvent
|
||||
IoCreateUnprotectedSymbolicLink
|
||||
IoDeleteController
|
||||
IoDeleteDevice
|
||||
IoDeleteDriver
|
||||
IoDeleteSymbolicLink
|
||||
IoDetachDevice
|
||||
IoDisconnectInterrupt
|
||||
IoEnqueueIrp
|
||||
IoEnumerateDeviceObjectList
|
||||
IoFlushAdapterBuffers
|
||||
IoForwardIrpSynchronously
|
||||
IoFreeAdapterChannel
|
||||
IoFreeController
|
||||
IoFreeErrorLogEntry
|
||||
IoFreeIrp
|
||||
IoFreeMapRegisters
|
||||
IoFreeMdl
|
||||
IoFreeWorkItem
|
||||
IoGetAttachedDevice
|
||||
IoGetAttachedDeviceReference
|
||||
IoGetBaseFileSystemDeviceObject
|
||||
IoGetBootDiskInformation
|
||||
IoGetConfigurationInformation
|
||||
IoGetCurrentProcess
|
||||
IoGetDeviceAttachmentBaseRef
|
||||
IoGetDeviceInterfaceAlias
|
||||
IoGetDeviceInterfaces
|
||||
IoGetDeviceObjectPointer
|
||||
IoGetDeviceProperty
|
||||
IoGetDeviceToVerify
|
||||
IoGetDiskDeviceObject
|
||||
IoGetDriverObjectExtension
|
||||
IoGetFileObjectGenericMapping
|
||||
IoGetInitialStack
|
||||
IoGetLowerDeviceObject
|
||||
IoGetRelatedDeviceObject
|
||||
IoGetRequestorProcess
|
||||
IoGetRequestorProcessId
|
||||
IoGetRequestorSessionId
|
||||
IoGetStackLimits
|
||||
IoGetTopLevelIrp
|
||||
IoInitializeIrp
|
||||
IoInitializeRemoveLockEx
|
||||
IoInitializeTimer
|
||||
IoInvalidateDeviceRelations
|
||||
IoInvalidateDeviceState
|
||||
IoIsFileOriginRemote
|
||||
IoIsOperationSynchronous
|
||||
IoIsSystemThread
|
||||
IoIsValidNameGraftingBuffer
|
||||
IoMakeAssociatedIrp
|
||||
IoMapTransfer
|
||||
IoOpenDeviceInstanceKey
|
||||
IoOpenDeviceInterfaceRegistryKey
|
||||
IoOpenDeviceRegistryKey
|
||||
IoPageRead
|
||||
IoPnPDeliverServicePowerNotification
|
||||
IoQueryDeviceDescription
|
||||
IoQueryDeviceEnumInfo
|
||||
IoQueryFileDosDeviceName
|
||||
IoQueryFileInformation
|
||||
IoQueryVolumeInformation
|
||||
IoQueueThreadIrp
|
||||
IoQueueWorkItem
|
||||
IoRaiseHardError
|
||||
IoRaiseInformationalHardError
|
||||
IoReadDiskSignature
|
||||
IoReadPartitionTableEx
|
||||
IoRegisterBootDriverReinitialization
|
||||
IoRegisterDeviceInterface
|
||||
IoRegisterDriverReinitialization
|
||||
IoRegisterFileSystem
|
||||
IoRegisterFsRegistrationChange
|
||||
IoRegisterLastChanceShutdownNotification
|
||||
IoRegisterPlugPlayNotification
|
||||
IoRegisterShutdownNotification
|
||||
IoReleaseCancelSpinLock
|
||||
IoReleaseRemoveLockAndWaitEx
|
||||
IoReleaseRemoveLockEx
|
||||
IoReleaseVpbSpinLock
|
||||
IoRemoveShareAccess
|
||||
IoReportDetectedDevice
|
||||
IoReportHalResourceUsage
|
||||
IoReportResourceForDetection
|
||||
IoReportResourceUsage
|
||||
IoReportTargetDeviceChange
|
||||
IoReportTargetDeviceChangeAsynchronous
|
||||
IoRequestDeviceEject
|
||||
IoReuseIrp
|
||||
IoSetCompletionRoutineEx
|
||||
IoSetDeviceInterfaceState
|
||||
IoSetDeviceToVerify
|
||||
IoSetFileOrigin
|
||||
IoSetHardErrorOrVerifyDevice
|
||||
IoSetInformation
|
||||
IoSetIoCompletion
|
||||
IoSetPartitionInformationEx
|
||||
IoSetShareAccess
|
||||
IoSetStartIoAttributes
|
||||
IoSetSystemPartition
|
||||
IoSetThreadHardErrorMode
|
||||
IoSetTopLevelIrp
|
||||
IoStartNextPacket
|
||||
IoStartNextPacketByKey
|
||||
IoStartPacket
|
||||
IoStartTimer
|
||||
IoStopTimer
|
||||
IoSynchronousInvalidateDeviceRelations
|
||||
IoSynchronousPageWrite
|
||||
IoUnregisterFileSystem
|
||||
IoUnregisterFsRegistrationChange
|
||||
IoUnregisterPlugPlayNotification
|
||||
IoUnregisterShutdownNotification
|
||||
IoUpdateShareAccess
|
||||
IoValidateDeviceIoControlAccess
|
||||
IoVerifyPartitionTable
|
||||
IoVerifyVolume
|
||||
IoVolumeDeviceToDosName
|
||||
IoWMIAllocateInstanceIds
|
||||
IoWMIDeviceObjectToInstanceName
|
||||
IoWMIExecuteMethod
|
||||
IoWMIHandleToInstanceName
|
||||
IoWMIOpenBlock
|
||||
IoWMIQueryAllData
|
||||
IoWMIQueryAllDataMultiple
|
||||
IoWMIQuerySingleInstance
|
||||
IoWMIQuerySingleInstanceMultiple
|
||||
IoWMIRegistrationControl
|
||||
IoWMISetNotificationCallback
|
||||
IoWMISetSingleInstance
|
||||
IoWMISetSingleItem
|
||||
IoWMISuggestInstanceName
|
||||
IoWMIWriteEvent
|
||||
IoWriteErrorLogEntry
|
||||
IoWritePartitionTableEx
|
||||
KPRIORITY
|
||||
KdPortGetByte
|
||||
KdPortPollByte
|
||||
KdPortPutByte
|
||||
Ke386QueryIoAccessMap
|
||||
Ke386SetIoAccessMap
|
||||
KeAcquireInterruptSpinLock
|
||||
KeAreApcsDisabled
|
||||
KeCapturePersistentThreadState
|
||||
KeDeregisterBugCheckReasonCallback
|
||||
KeFindConfigurationEntry
|
||||
KeFindConfigurationNextEntry
|
||||
KeFlushEntireTb
|
||||
KeFlushQueuedDpcs
|
||||
KeGetRecommendedSharedDataAlignment
|
||||
KeIsExecutingDpc
|
||||
KeQueryActiveProcessors
|
||||
KeQueryPerformanceCounter
|
||||
KeQueryPriorityThread
|
||||
KeQueryRuntimeThread
|
||||
KeQuerySystemTime
|
||||
KeQueryTickCount
|
||||
KeQueryTimeIncrement
|
||||
KeRaiseIrql
|
||||
KeRaiseIrqlToDpcLevel
|
||||
KeRaiseUserException
|
||||
KeReadStateEvent
|
||||
KeRegisterBugCheckCallback
|
||||
KeRegisterBugCheckReasonCallback
|
||||
KeReleaseInterruptSpinLock
|
||||
KeReleaseMutant
|
||||
KeReleaseMutex
|
||||
KeReleaseSemaphore
|
||||
KeReleaseSpinLock
|
||||
KeReleaseSpinLockFromDpcLevel
|
||||
KeReleaseSpinLockFromDpcLevel
|
||||
KeRemoveByKeyDeviceQueue
|
||||
KeRemoveByKeyDeviceQueueIfBusy
|
||||
KeRemoveDeviceQueue
|
||||
KeRemoveEntryDeviceQueue
|
||||
KeRemoveSystemServiceTable
|
||||
KeRestoreFloatingPointState
|
||||
KeRevertToUserAffinityThread
|
||||
KeRosDumpStackFrames
|
||||
KeRosGetStackFrames
|
||||
KeRosPrintAddress
|
||||
KeSaveFloatingPointState
|
||||
KeSetDmaIoCoherency
|
||||
KeSetEvent
|
||||
KeSetEventBoostPriority
|
||||
KeSetIdealProcessorThread
|
||||
KeSetKernelStackSwapEnable
|
||||
KeSetProfileIrql
|
||||
KeSetSystemAffinityThread
|
||||
KeSetTimeIncrement
|
||||
KeTerminateThread
|
||||
KeUserModeCallback
|
||||
KeWaitForMutexObject
|
||||
KeWaitForSingleObject
|
||||
KiCoprocessorError
|
||||
KiUnexpectedInterrupt
|
||||
LONG
|
||||
LdrFindResourceDirectory_U
|
||||
MmAddPhysicalMemory
|
||||
MmAddVerifierThunks
|
||||
MmAdjustWorkingSetSize
|
||||
MmAdvanceMdl
|
||||
MmAllocateContiguousMemory
|
||||
MmAllocateContiguousMemorySpecifyCache
|
||||
MmAllocateMappingAddress
|
||||
MmAllocateNonCachedMemory
|
||||
MmBuildMdlForNonPagedPool
|
||||
MmCanFileBeTruncated
|
||||
MmCreateMdl
|
||||
MmCreateSection
|
||||
MmDbgTranslatePhysicalAddress
|
||||
MmDisableModifiedWriteOfSection
|
||||
MmFlushImageSection
|
||||
MmForceSectionClosed
|
||||
MmFreeContiguousMemory
|
||||
MmFreeMappingAddress
|
||||
MmFreeNonCachedMemory
|
||||
MmGetPhysicalAddress
|
||||
MmGetPhysicalMemoryRanges
|
||||
MmGetSystemRoutineAddress
|
||||
MmGetVirtualForPhysical
|
||||
MmGrowKernelStack
|
||||
MmIsAddressValid
|
||||
MmIsDriverVerifying
|
||||
MmIsNonPagedSystemAddressValid
|
||||
MmIsRecursiveIoFault
|
||||
MmIsThisAnNtAsSystem
|
||||
MmIsVerifierEnabled
|
||||
MmLockPagableDataSection
|
||||
MmLockPagableImageSection
|
||||
MmLockPagableSectionByHandle
|
||||
MmMapIoSpace
|
||||
MmMapLockedPages
|
||||
MmMapLockedPagesWithReservedMapping
|
||||
MmMapMemoryDumpMdl
|
||||
MmMapUserAddressesToPage
|
||||
MmMapVideoDisplay
|
||||
MmMapViewInSessionSpace
|
||||
MmMapViewInSystemSpace
|
||||
MmMapViewOfSection
|
||||
MmMarkPhysicalMemoryAsBad
|
||||
MmMarkPhysicalMemoryAsGood
|
||||
MmPageEntireDriver
|
||||
MmPrefetchPages
|
||||
MmProbeAndLockPages
|
||||
MmProbeAndLockProcessPages
|
||||
MmProbeAndLockSelectedPages
|
||||
MmProtectMdlSystemAddress
|
||||
MmQuerySystemSize
|
||||
MmRemovePhysicalMemory
|
||||
MmResetDriverPaging
|
||||
MmSecureVirtualMemory
|
||||
MmSetAddressRangeModified
|
||||
MmSetBankedSection
|
||||
MmSizeOfMdl
|
||||
MmTrimAllSystemPagableMemory
|
||||
MmUnlockPagableImageSection
|
||||
MmUnlockPages
|
||||
MmUnmapIoSpace
|
||||
MmUnmapLockedPages
|
||||
MmUnmapReservedMapping
|
||||
MmUnmapVideoDisplay
|
||||
MmUnmapViewInSessionSpace
|
||||
MmUnmapViewInSystemSpace
|
||||
MmUnmapViewOfSection
|
||||
MmUnsecureVirtualMemory
|
||||
OUT
|
||||
ObCreateObject
|
||||
PEJOB
|
||||
PEPROCESS
|
||||
PKBUGCHECK_CALLBACK_RECORD
|
||||
PKDEVICE_QUEUE_ENTRY
|
||||
PKIRQL
|
||||
PULONG
|
||||
PVOID
|
||||
PW32_THREAD_CALLBACK
|
||||
PoCallDriver
|
||||
PoRegisterDeviceForIdleDetection
|
||||
PoRegisterSystemState
|
||||
PoRequestPowerIrp
|
||||
PoSetDeviceBusy
|
||||
PoSetPowerState
|
||||
PoSetSystemState
|
||||
PoStartNextPowerIrp
|
||||
PoUnregisterSystemState
|
||||
ProbeForRead
|
||||
ProbeForWrite
|
||||
PsAssignImpersonationToken
|
||||
PsCreateSystemProcess
|
||||
PsCreateSystemThread
|
||||
PsGetCurrentProcessId
|
||||
PsGetCurrentThreadId
|
||||
PsImpersonateClient
|
||||
PsReferenceImpersonationToken
|
||||
PsReferencePrimaryToken
|
||||
PsRevertThreadToSelf
|
||||
PsRevertToSelf
|
||||
PsTerminateSystemThread
|
||||
READ_PORT_BUFFER_UCHAR
|
||||
READ_PORT_BUFFER_ULONG
|
||||
READ_PORT_BUFFER_USHORT
|
||||
READ_PORT_UCHAR
|
||||
READ_PORT_ULONG
|
||||
READ_PORT_USHORT
|
||||
SeAssignSecurityEx
|
||||
SeAuditHardLinkCreation
|
||||
SeAuditingFileEvents
|
||||
SeAuditingFileEventsWithContext
|
||||
SeAuditingFileOrGlobalEvents
|
||||
SeAuditingHardLinkEvents
|
||||
SeAuditingHardLinkEventsWithContext
|
||||
SeCaptureSecurityDescriptor
|
||||
SeCaptureSubjectContext
|
||||
SeCloseObjectAuditAlarm
|
||||
SeCreateAccessState
|
||||
SeCreateClientSecurityFromSubjectContext
|
||||
SeFilterToken
|
||||
SeImpersonateClientEx
|
||||
SePrivilegeObjectAuditAlarm
|
||||
SeQueryInformationToken
|
||||
SeQuerySessionIdToken
|
||||
SeReleaseSecurityDescriptor
|
||||
SeSetSecurityDescriptorInfoEx
|
||||
SeTokenIsAdmin
|
||||
SeTokenIsRestricted
|
||||
SeTokenIsWriteRestricted
|
||||
WRITE_PORT_BUFFER_UCHAR
|
||||
WRITE_PORT_BUFFER_ULONG
|
||||
WRITE_PORT_BUFFER_USHORT
|
||||
WRITE_PORT_UCHAR
|
||||
WRITE_PORT_ULONG
|
||||
WRITE_PORT_USHORT
|
10
irc/ArchBlackmann/grovel.txt
Normal file
10
irc/ArchBlackmann/grovel.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
/me bows humbly and begs %s's forgiveness
|
||||
%s is soo cool... I hope to be like him some day
|
||||
/me hides in a corner and hopes %s doesn't beat him with the whipping noodle again
|
||||
/me prostrates at %s's feet and begs his majesty's forgiveness
|
||||
%s: please don't hurt me!
|
||||
I'm not worthy... I'm not worthy...
|
||||
/me sings %s's praises to the world!
|
||||
/me thinks %s is smarter than %dev%
|
||||
%s: oh please may I defrag your sock drawer?
|
||||
/me gives %s a cookie, hoping it will make up for breaking %func% the other day...
|
9
irc/ArchBlackmann/irql.txt
Normal file
9
irc/ArchBlackmann/irql.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
PASSIVE_LEVEL
|
||||
APC_LEVEL
|
||||
DISPATCH_LEVEL
|
||||
PROFILE_LEVEL
|
||||
CLOCK1_LEVEL
|
||||
IPI_LEVEL
|
||||
POWER_LEVEL
|
||||
HIGH_LEVEL
|
||||
SYNCH_LEVEL
|
5
irc/ArchBlackmann/nogrovel.txt
Normal file
5
irc/ArchBlackmann/nogrovel.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
/me slaps %s with a large trout
|
||||
recycle(%s)
|
||||
Did I hear something? Musta been a %s-fly... Where's that fly-swatter?
|
||||
%s: go away son, you bother me....
|
||||
/me beats %s with the whipping noodle
|
654
irc/ArchBlackmann/status.txt
Normal file
654
irc/ArchBlackmann/status.txt
Normal file
@@ -0,0 +1,654 @@
|
||||
RPC_NT_ALREADY_LISTENING
|
||||
RPC_NT_ALREADY_REGISTERED
|
||||
RPC_NT_CALL_FAILED
|
||||
RPC_NT_CALL_FAILED_DNE
|
||||
RPC_NT_CANT_CREATE_ENDPOINT
|
||||
RPC_NT_INVALID_BINDING
|
||||
RPC_NT_INVALID_ENDPOINT_FORMAT
|
||||
RPC_NT_INVALID_NETWORK_OPTIONS
|
||||
RPC_NT_INVALID_NET_ADDR
|
||||
RPC_NT_INVALID_RPC_PROTSEQ
|
||||
RPC_NT_INVALID_STRING_BINDING
|
||||
RPC_NT_INVALID_STRING_UUID
|
||||
RPC_NT_INVALID_TIMEOUT
|
||||
RPC_NT_NOT_LISTENING
|
||||
RPC_NT_NO_BINDINGS
|
||||
RPC_NT_NO_CALL_ACTIVE
|
||||
RPC_NT_NO_ENDPOINT_FOUND
|
||||
RPC_NT_NO_PROTSEQS
|
||||
RPC_NT_NO_PROTSEQS_REGISTERED
|
||||
RPC_NT_OBJECT_NOT_FOUND
|
||||
RPC_NT_OUT_OF_RESOURCES
|
||||
RPC_NT_PROTOCOL_ERROR
|
||||
RPC_NT_PROTSEQ_NOT_SUPPORTED
|
||||
RPC_NT_SERVER_TOO_BUSY
|
||||
RPC_NT_SERVER_UNAVAILABLE
|
||||
RPC_NT_SS_IN_NULL_CONTEXT
|
||||
RPC_NT_TYPE_ALREADY_REGISTERED
|
||||
RPC_NT_UNKNOWN_IF
|
||||
RPC_NT_UNKNOWN_MGR_TYPE
|
||||
RPC_NT_WRONG_KIND_OF_BINDING
|
||||
STATUS_ABANDONED
|
||||
STATUS_ABANDONED_WAIT_0
|
||||
STATUS_ABANDONED_WAIT_63
|
||||
STATUS_ABIOS_INVALID_COMMAND
|
||||
STATUS_ABIOS_INVALID_LID
|
||||
STATUS_ABIOS_INVALID_SELECTOR
|
||||
STATUS_ABIOS_LID_ALREADY_OWNED
|
||||
STATUS_ABIOS_LID_NOT_EXIST
|
||||
STATUS_ABIOS_NOT_LID_OWNER
|
||||
STATUS_ABIOS_NOT_PRESENT
|
||||
STATUS_ABIOS_SELECTOR_NOT_AVAILABLE
|
||||
STATUS_ACCESS_DENIED
|
||||
STATUS_ACCESS_VIOLATION
|
||||
STATUS_ACCOUNT_DISABLED
|
||||
STATUS_ACCOUNT_EXPIRED
|
||||
STATUS_ACCOUNT_LOCKED_OUT
|
||||
STATUS_ACCOUNT_RESTRICTION
|
||||
STATUS_ADAPTER_HARDWARE_ERROR
|
||||
STATUS_ADDRESS_ALREADY_ASSOCIATED
|
||||
STATUS_ADDRESS_ALREADY_EXISTS
|
||||
STATUS_ADDRESS_CLOSED
|
||||
STATUS_ADDRESS_NOT_ASSOCIATED
|
||||
STATUS_AGENTS_EXHAUSTED
|
||||
STATUS_ALERTED
|
||||
STATUS_ALIAS_EXISTS
|
||||
STATUS_ALLOCATE_BUCKET
|
||||
STATUS_ALLOTTED_SPACE_EXCEEDED
|
||||
STATUS_ALREADY_COMMITTED
|
||||
STATUS_ALREADY_DISCONNECTED
|
||||
STATUS_ALREADY_WIN32
|
||||
STATUS_APP_INIT_FAILURE
|
||||
STATUS_ARBITRATION_UNHANDLED
|
||||
STATUS_ARRAY_BOUNDS_EXCEEDED
|
||||
STATUS_AUDIT_FAILED
|
||||
STATUS_BACKUP_CONTROLLER
|
||||
STATUS_BAD_COMPRESSION_BUFFER
|
||||
STATUS_BAD_CURRENT_DIRECTORY
|
||||
STATUS_BAD_DESCRIPTOR_FORMAT
|
||||
STATUS_BAD_DEVICE_TYPE
|
||||
STATUS_BAD_DLL_ENTRYPOINT
|
||||
STATUS_BAD_FUNCTION_TABLE
|
||||
STATUS_BAD_IMPERSONATION_LEVEL
|
||||
STATUS_BAD_INHERITANCE_ACL
|
||||
STATUS_BAD_INITIAL_PC
|
||||
STATUS_BAD_INITIAL_STACK
|
||||
STATUS_BAD_LOGON_SESSION_STATE
|
||||
STATUS_BAD_MASTER_BOOT_RECORD
|
||||
STATUS_BAD_NETWORK_NAME
|
||||
STATUS_BAD_NETWORK_PATH
|
||||
STATUS_BAD_REMOTE_ADAPTER
|
||||
STATUS_BAD_SERVICE_ENTRYPOINT
|
||||
STATUS_BAD_STACK
|
||||
STATUS_BAD_TOKEN_TYPE
|
||||
STATUS_BAD_VALIDATION_CLASS
|
||||
STATUS_BAD_WORKING_SET_LIMIT
|
||||
STATUS_BEGINNING_OF_MEDIA
|
||||
STATUS_BIOS_FAILED_TO_CONNECT_INTERRUPT
|
||||
STATUS_BREAKPOINT
|
||||
STATUS_BUFFER_OVERFLOW
|
||||
STATUS_BUFFER_TOO_SMALL
|
||||
STATUS_BUS_RESET
|
||||
STATUS_CANCELLED
|
||||
STATUS_CANNOT_DELETE
|
||||
STATUS_CANNOT_IMPERSONATE
|
||||
STATUS_CANNOT_LOAD_REGISTRY_FILE
|
||||
STATUS_CANT_ACCESS_DOMAIN_INFO
|
||||
STATUS_CANT_DISABLE_MANDATORY
|
||||
STATUS_CANT_OPEN_ANONYMOUS
|
||||
STATUS_CANT_TERMINATE_SELF
|
||||
STATUS_CANT_WAIT
|
||||
STATUS_CARDBUS_NOT_SUPPORTED
|
||||
STATUS_CHECKING_FILE_SYSTEM
|
||||
STATUS_CHILD_MUST_BE_VOLATILE
|
||||
STATUS_CLIENT_SERVER_PARAMETERS_INVALID
|
||||
STATUS_COMMITMENT_LIMIT
|
||||
STATUS_CONFLICTING_ADDRESSES
|
||||
STATUS_CONNECTION_ABORTED
|
||||
STATUS_CONNECTION_ACTIVE
|
||||
STATUS_CONNECTION_COUNT_LIMIT
|
||||
STATUS_CONNECTION_DISCONNECTED
|
||||
STATUS_CONNECTION_INVALID
|
||||
STATUS_CONNECTION_IN_USE
|
||||
STATUS_CONNECTION_REFUSED
|
||||
STATUS_CONNECTION_RESET
|
||||
STATUS_CONTROL_C_EXIT
|
||||
STATUS_CONVERT_TO_LARGE
|
||||
STATUS_COULD_NOT_INTERPRET
|
||||
STATUS_CRC_ERROR
|
||||
STATUS_CTL_FILE_NOT_SUPPORTED
|
||||
STATUS_DATATYPE_MISALIGNMENT
|
||||
STATUS_DATA_ERROR
|
||||
STATUS_DATA_LATE_ERROR
|
||||
STATUS_DATA_NOT_ACCEPTED
|
||||
STATUS_DATA_OVERRUN
|
||||
STATUS_DEBUG_ATTACH_FAILED
|
||||
STATUS_DELETE_PENDING
|
||||
STATUS_DEVICE_ALREADY_ATTACHED
|
||||
STATUS_DEVICE_BUSY
|
||||
STATUS_DEVICE_CONFIGURATION_ERROR
|
||||
STATUS_DEVICE_DATA_ERROR
|
||||
STATUS_DEVICE_DOES_NOT_EXIST
|
||||
STATUS_DEVICE_NOT_CONNECTED
|
||||
STATUS_DEVICE_NOT_PARTITIONED
|
||||
STATUS_DEVICE_NOT_READY
|
||||
STATUS_DEVICE_OFF_LINE
|
||||
STATUS_DEVICE_PAPER_EMPTY
|
||||
STATUS_DEVICE_POWERED_OFF
|
||||
STATUS_DEVICE_POWER_FAILURE
|
||||
STATUS_DEVICE_PROTOCOL_ERROR
|
||||
STATUS_DFS_EXIT_PATH_FOUND
|
||||
STATUS_DFS_UNAVAILABLE
|
||||
STATUS_DIRECTORY_NOT_EMPTY
|
||||
STATUS_DISK_CORRUPT_ERROR
|
||||
STATUS_DISK_FULL
|
||||
STATUS_DISK_OPERATION_FAILED
|
||||
STATUS_DISK_RECALIBRATE_FAILED
|
||||
STATUS_DISK_RESET_FAILED
|
||||
STATUS_DLL_INIT_FAILED
|
||||
STATUS_DLL_INIT_FAILED_LOGOFF
|
||||
STATUS_DLL_NOT_FOUND
|
||||
STATUS_DOMAIN_CONTROLLER_NOT_FOUND
|
||||
STATUS_DOMAIN_CTRLR_CONFIG_ERROR
|
||||
STATUS_DOMAIN_EXISTS
|
||||
STATUS_DOMAIN_LIMIT_EXCEEDED
|
||||
STATUS_DOMAIN_TRUST_INCONSISTENT
|
||||
STATUS_DRIVER_CANCEL_TIMEOUT
|
||||
STATUS_DRIVER_ENTRYPOINT_NOT_FOUND
|
||||
STATUS_DRIVER_INTERNAL_ERROR
|
||||
STATUS_DRIVER_ORDINAL_NOT_FOUND
|
||||
STATUS_DRIVER_UNABLE_TO_LOAD
|
||||
STATUS_DUPLICATE_NAME
|
||||
STATUS_DUPLICATE_OBJECTID
|
||||
STATUS_EAS_NOT_SUPPORTED
|
||||
STATUS_EA_CORRUPT_ERROR
|
||||
STATUS_EA_LIST_INCONSISTENT
|
||||
STATUS_EA_TOO_LARGE
|
||||
STATUS_END_OF_FILE
|
||||
STATUS_END_OF_MEDIA
|
||||
STATUS_ENTRYPOINT_NOT_FOUND
|
||||
STATUS_EOM_OVERFLOW
|
||||
STATUS_EVALUATION_EXPIRATION
|
||||
STATUS_EVENTLOG_CANT_START
|
||||
STATUS_EVENTLOG_FILE_CHANGED
|
||||
STATUS_EVENTLOG_FILE_CORRUPT
|
||||
STATUS_EVENT_DONE
|
||||
STATUS_EVENT_PENDING
|
||||
STATUS_EXTRANEOUS_INFORMATION
|
||||
STATUS_FAIL_CHECK
|
||||
STATUS_FATAL_APP_EXIT
|
||||
STATUS_FILEMARK_DETECTED
|
||||
STATUS_FILES_OPEN
|
||||
STATUS_FILE_CLOSED
|
||||
STATUS_FILE_CORRUPT_ERROR
|
||||
STATUS_FILE_DELETED
|
||||
STATUS_FILE_FORCED_CLOSED
|
||||
STATUS_FILE_INVALID
|
||||
STATUS_FILE_IS_A_DIRECTORY
|
||||
STATUS_FILE_IS_OFFLINE
|
||||
STATUS_FILE_LOCK_CONFLICT
|
||||
STATUS_FILE_RENAMED
|
||||
STATUS_FLOAT_DENORMAL_OPERAND
|
||||
STATUS_FLOAT_DIVIDE_BY_ZERO
|
||||
STATUS_FLOAT_INEXACT_RESULT
|
||||
STATUS_FLOAT_INVALID_OPERATION
|
||||
STATUS_FLOAT_OVERFLOW
|
||||
STATUS_FLOAT_STACK_CHECK
|
||||
STATUS_FLOAT_UNDERFLOW
|
||||
STATUS_FLOPPY_BAD_REGISTERS
|
||||
STATUS_FLOPPY_ID_MARK_NOT_FOUND
|
||||
STATUS_FLOPPY_UNKNOWN_ERROR
|
||||
STATUS_FLOPPY_VOLUME
|
||||
STATUS_FLOPPY_WRONG_CYLINDER
|
||||
STATUS_FOUND_OUT_OF_SCOPE
|
||||
STATUS_FREE_VM_NOT_AT_BASE
|
||||
STATUS_FS_DRIVER_REQUIRED
|
||||
STATUS_FT_MISSING_MEMBER
|
||||
STATUS_FT_ORPHANING
|
||||
STATUS_FT_READ_RECOVERING_FROM_BACKUP
|
||||
STATUS_FT_WRITE_RECOVERY
|
||||
STATUS_FULLSCREEN_MODE
|
||||
STATUS_GENERIC_NOT_MAPPED
|
||||
STATUS_GRACEFUL_DISCONNECT
|
||||
STATUS_GROUP_EXISTS
|
||||
STATUS_GUARD_PAGE_VIOLATION
|
||||
STATUS_GUIDS_EXHAUSTED
|
||||
STATUS_GUID_SUBSTITUTION_MADE
|
||||
STATUS_HANDLES_CLOSED
|
||||
STATUS_HANDLE_NOT_CLOSABLE
|
||||
STATUS_HOST_UNREACHABLE
|
||||
STATUS_ILLEGAL_CHARACTER
|
||||
STATUS_ILLEGAL_DLL_RELOCATION
|
||||
STATUS_ILLEGAL_FLOAT_CONTEXT
|
||||
STATUS_ILLEGAL_FUNCTION
|
||||
STATUS_ILLEGAL_INSTRUCTION
|
||||
STATUS_ILL_FORMED_PASSWORD
|
||||
STATUS_ILL_FORMED_SERVICE_ENTRY
|
||||
STATUS_IMAGE_ALREADY_LOADED
|
||||
STATUS_IMAGE_CHECKSUM_MISMATCH
|
||||
STATUS_IMAGE_MACHINE_TYPE_MISMATCH
|
||||
STATUS_IMAGE_MACHINE_TYPE_MISMATCH_EXE
|
||||
STATUS_IMAGE_MP_UP_MISMATCH
|
||||
STATUS_IMAGE_NOT_AT_BASE
|
||||
STATUS_INCOMPATIBLE_FILE_MAP
|
||||
STATUS_INFO_LENGTH_MISMATCH
|
||||
STATUS_INSTANCE_NOT_AVAILABLE
|
||||
STATUS_INSTRUCTION_MISALIGNMENT
|
||||
STATUS_INSUFFICIENT_LOGON_INFO
|
||||
STATUS_INSUFFICIENT_RESOURCES
|
||||
STATUS_INSUFF_SERVER_RESOURCES
|
||||
STATUS_INTEGER_DIVIDE_BY_ZERO
|
||||
STATUS_INTEGER_OVERFLOW
|
||||
STATUS_INTERNAL_DB_CORRUPTION
|
||||
STATUS_INTERNAL_DB_ERROR
|
||||
STATUS_INTERNAL_ERROR
|
||||
STATUS_INVALID_ACCOUNT_NAME
|
||||
STATUS_INVALID_ACL
|
||||
STATUS_INVALID_ADDRESS
|
||||
STATUS_INVALID_ADDRESS_COMPONENT
|
||||
STATUS_INVALID_ADDRESS_WILDCARD
|
||||
STATUS_INVALID_BLOCK_LENGTH
|
||||
STATUS_INVALID_BUFFER_SIZE
|
||||
STATUS_INVALID_CID
|
||||
STATUS_INVALID_COMPUTER_NAME
|
||||
STATUS_INVALID_CONNECTION
|
||||
STATUS_INVALID_DEVICE_REQUEST
|
||||
STATUS_INVALID_DEVICE_STATE
|
||||
STATUS_INVALID_DISPOSITION
|
||||
STATUS_INVALID_DOMAIN_ROLE
|
||||
STATUS_INVALID_DOMAIN_STATE
|
||||
STATUS_INVALID_EA_FLAG
|
||||
STATUS_INVALID_EA_NAME
|
||||
STATUS_INVALID_FILE_FOR_SECTION
|
||||
STATUS_INVALID_GROUP_ATTRIBUTES
|
||||
STATUS_INVALID_HANDLE
|
||||
STATUS_INVALID_HW_PROFILE
|
||||
STATUS_INVALID_ID_AUTHORITY
|
||||
STATUS_INVALID_IMAGE_FORMAT
|
||||
STATUS_INVALID_IMAGE_LE_FORMAT
|
||||
STATUS_INVALID_IMAGE_NE_FORMAT
|
||||
STATUS_INVALID_IMAGE_NOT_MZ
|
||||
STATUS_INVALID_IMAGE_PROTECT
|
||||
STATUS_INVALID_IMAGE_WIN_16
|
||||
STATUS_INVALID_INFO_CLASS
|
||||
STATUS_INVALID_LDT_DESCRIPTOR
|
||||
STATUS_INVALID_LDT_OFFSET
|
||||
STATUS_INVALID_LDT_SIZE
|
||||
STATUS_INVALID_LEVEL
|
||||
STATUS_INVALID_LOCK_SEQUENCE
|
||||
STATUS_INVALID_LOGON_HOURS
|
||||
STATUS_INVALID_LOGON_TYPE
|
||||
STATUS_INVALID_MEMBER
|
||||
STATUS_INVALID_NETWORK_RESPONSE
|
||||
STATUS_INVALID_OPLOCK_PROTOCOL
|
||||
STATUS_INVALID_OWNER
|
||||
STATUS_INVALID_PAGE_PROTECTION
|
||||
STATUS_INVALID_PARAMETER
|
||||
STATUS_INVALID_PARAMETER_1
|
||||
STATUS_INVALID_PARAMETER_10
|
||||
STATUS_INVALID_PARAMETER_11
|
||||
STATUS_INVALID_PARAMETER_12
|
||||
STATUS_INVALID_PARAMETER_2
|
||||
STATUS_INVALID_PARAMETER_3
|
||||
STATUS_INVALID_PARAMETER_4
|
||||
STATUS_INVALID_PARAMETER_5
|
||||
STATUS_INVALID_PARAMETER_6
|
||||
STATUS_INVALID_PARAMETER_7
|
||||
STATUS_INVALID_PARAMETER_8
|
||||
STATUS_INVALID_PARAMETER_9
|
||||
STATUS_INVALID_PARAMETER_MIX
|
||||
STATUS_INVALID_PIPE_STATE
|
||||
STATUS_INVALID_PLUGPLAY_DEVICE_PATH
|
||||
STATUS_INVALID_PORT_ATTRIBUTES
|
||||
STATUS_INVALID_PORT_HANDLE
|
||||
STATUS_INVALID_PRIMARY_GROUP
|
||||
STATUS_INVALID_QUOTA_LOWER
|
||||
STATUS_INVALID_READ_MODE
|
||||
STATUS_INVALID_SECURITY_DESCR
|
||||
STATUS_INVALID_SERVER_STATE
|
||||
STATUS_INVALID_SID
|
||||
STATUS_INVALID_SUB_AUTHORITY
|
||||
STATUS_INVALID_SYSTEM_SERVICE
|
||||
STATUS_INVALID_UNWIND_TARGET
|
||||
STATUS_INVALID_USER_BUFFER
|
||||
STATUS_INVALID_VARIANT
|
||||
STATUS_INVALID_VIEW_SIZE
|
||||
STATUS_INVALID_VLM_OPERATION
|
||||
STATUS_INVALID_VOLUME_LABEL
|
||||
STATUS_INVALID_WORKSTATION
|
||||
STATUS_IN_PAGE_ERROR
|
||||
STATUS_IO_DEVICE_ERROR
|
||||
STATUS_IO_PRIVILEGE_FAILED
|
||||
STATUS_IO_REPARSE_DATA_INVALID
|
||||
STATUS_IO_REPARSE_TAG_INVALID
|
||||
STATUS_IO_REPARSE_TAG_MISMATCH
|
||||
STATUS_IO_REPARSE_TAG_NOT_HANDLED
|
||||
STATUS_IO_TIMEOUT
|
||||
STATUS_IP_ADDRESS_CONFLICT1
|
||||
STATUS_IP_ADDRESS_CONFLICT2
|
||||
STATUS_KERNEL_APC
|
||||
STATUS_KEY_DELETED
|
||||
STATUS_KEY_HAS_CHILDREN
|
||||
STATUS_LAST_ADMIN
|
||||
STATUS_LICENSE_QUOTA_EXCEEDED
|
||||
STATUS_LICENSE_VIOLATION
|
||||
STATUS_LINK_FAILED
|
||||
STATUS_LINK_TIMEOUT
|
||||
STATUS_LM_CROSS_ENCRYPTION_REQUIRED
|
||||
STATUS_LOCAL_DISCONNECT
|
||||
STATUS_LOCAL_USER_SESSION_KEY
|
||||
STATUS_LOCK_NOT_GRANTED
|
||||
STATUS_LOGIN_TIME_RESTRICTION
|
||||
STATUS_LOGIN_WKSTA_RESTRICTION
|
||||
STATUS_LOGON_FAILURE
|
||||
STATUS_LOGON_NOT_GRANTED
|
||||
STATUS_LOGON_SERVER_CONFLICT
|
||||
STATUS_LOGON_SESSION_COLLISION
|
||||
STATUS_LOGON_SESSION_EXISTS
|
||||
STATUS_LOGON_TYPE_NOT_GRANTED
|
||||
STATUS_LOG_FILE_FULL
|
||||
STATUS_LOG_HARD_ERROR
|
||||
STATUS_LONGJUMP
|
||||
STATUS_LOST_WRITEBEHIND_DATA
|
||||
STATUS_LPC_REPLY_LOST
|
||||
STATUS_LUIDS_EXHAUSTED
|
||||
STATUS_MAPPED_ALIGNMENT
|
||||
STATUS_MAPPED_FILE_SIZE_ZERO
|
||||
STATUS_MARSHALL_OVERFLOW
|
||||
STATUS_MEDIA_CHANGED
|
||||
STATUS_MEDIA_CHECK
|
||||
STATUS_MEDIA_WRITE_PROTECTED
|
||||
STATUS_MEMBERS_PRIMARY_GROUP
|
||||
STATUS_MEMBER_IN_ALIAS
|
||||
STATUS_MEMBER_IN_GROUP
|
||||
STATUS_MEMBER_NOT_IN_ALIAS
|
||||
STATUS_MEMBER_NOT_IN_GROUP
|
||||
STATUS_MEMORY_NOT_ALLOCATED
|
||||
STATUS_MESSAGE_NOT_FOUND
|
||||
STATUS_MISSING_SYSTEMFILE
|
||||
STATUS_MORE_ENTRIES
|
||||
STATUS_MORE_PROCESSING_REQUIRED
|
||||
STATUS_MUTANT_LIMIT_EXCEEDED
|
||||
STATUS_MUTANT_NOT_OWNED
|
||||
STATUS_NAME_TOO_LONG
|
||||
STATUS_NETLOGON_NOT_STARTED
|
||||
STATUS_NETWORK_ACCESS_DENIED
|
||||
STATUS_NETWORK_BUSY
|
||||
STATUS_NETWORK_CREDENTIAL_CONFLICT
|
||||
STATUS_NETWORK_NAME_DELETED
|
||||
STATUS_NETWORK_UNREACHABLE
|
||||
STATUS_NET_WRITE_FAULT
|
||||
STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT
|
||||
STATUS_NOLOGON_SERVER_TRUST_ACCOUNT
|
||||
STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT
|
||||
STATUS_NONCONTINUABLE_EXCEPTION
|
||||
STATUS_NONEXISTENT_EA_ENTRY
|
||||
STATUS_NONEXISTENT_SECTOR
|
||||
STATUS_NONE_MAPPED
|
||||
STATUS_NOTIFY_CLEANUP
|
||||
STATUS_NOTIFY_ENUM_DIR
|
||||
STATUS_NOT_ALL_ASSIGNED
|
||||
STATUS_NOT_A_DIRECTORY
|
||||
STATUS_NOT_A_REPARSE_POINT
|
||||
STATUS_NOT_CLIENT_SESSION
|
||||
STATUS_NOT_COMMITTED
|
||||
STATUS_NOT_FOUND
|
||||
STATUS_NOT_IMPLEMENTED
|
||||
STATUS_NOT_LOCKED
|
||||
STATUS_NOT_LOGON_PROCESS
|
||||
STATUS_NOT_MAPPED_DATA
|
||||
STATUS_NOT_MAPPED_VIEW
|
||||
STATUS_NOT_REGISTRY_FILE
|
||||
STATUS_NOT_SAME_DEVICE
|
||||
STATUS_NOT_SERVER_SESSION
|
||||
STATUS_NOT_SUPPORTED
|
||||
STATUS_NOT_TINY_STREAM
|
||||
STATUS_NO_BROWSER_SERVERS_FOUND
|
||||
STATUS_NO_CALLBACK_ACTIVE
|
||||
STATUS_NO_DATA_DETECTED
|
||||
STATUS_NO_EAS_ON_FILE
|
||||
STATUS_NO_EVENT_PAIR
|
||||
STATUS_NO_GUID_TRANSLATION
|
||||
STATUS_NO_IMPERSONATION_TOKEN
|
||||
STATUS_NO_INHERITANCE
|
||||
STATUS_NO_LDT
|
||||
STATUS_NO_LOGON_SERVERS
|
||||
STATUS_NO_LOG_SPACE
|
||||
STATUS_NO_MATCH
|
||||
STATUS_NO_MEDIA
|
||||
STATUS_NO_MEDIA_IN_DEVICE
|
||||
STATUS_NO_MEMORY
|
||||
STATUS_NO_MORE_EAS
|
||||
STATUS_NO_MORE_ENTRIES
|
||||
STATUS_NO_MORE_FILES
|
||||
STATUS_NO_MORE_MATCHES
|
||||
STATUS_NO_PAGEFILE
|
||||
STATUS_NO_QUOTAS_NO_ACCOUNT
|
||||
STATUS_NO_SECURITY_ON_OBJECT
|
||||
STATUS_NO_SPOOL_SPACE
|
||||
STATUS_NO_SUCH_ALIAS
|
||||
STATUS_NO_SUCH_DEVICE
|
||||
STATUS_NO_SUCH_DOMAIN
|
||||
STATUS_NO_SUCH_FILE
|
||||
STATUS_NO_SUCH_GROUP
|
||||
STATUS_NO_SUCH_LOGON_SESSION
|
||||
STATUS_NO_SUCH_MEMBER
|
||||
STATUS_NO_SUCH_PACKAGE
|
||||
STATUS_NO_SUCH_PRIVILEGE
|
||||
STATUS_NO_SUCH_USER
|
||||
STATUS_NO_TOKEN
|
||||
STATUS_NO_TRUST_LSA_SECRET
|
||||
STATUS_NO_TRUST_SAM_ACCOUNT
|
||||
STATUS_NO_USER_SESSION_KEY
|
||||
STATUS_NO_YIELD_PERFORMED
|
||||
STATUS_NT_CROSS_ENCRYPTION_REQUIRED
|
||||
STATUS_NULL_LM_PASSWORD
|
||||
STATUS_OBJECTID_EXISTS
|
||||
STATUS_OBJECT_EXISTS
|
||||
STATUS_OBJECT_NAME_COLLISION
|
||||
STATUS_OBJECT_NAME_EXISTS
|
||||
STATUS_OBJECT_NAME_INVALID
|
||||
STATUS_OBJECT_NAME_NOT_FOUND
|
||||
STATUS_OBJECT_PATH_INVALID
|
||||
STATUS_OBJECT_PATH_NOT_FOUND
|
||||
STATUS_OBJECT_PATH_SYNTAX_BAD
|
||||
STATUS_OBJECT_TYPE_MISMATCH
|
||||
STATUS_OPEN_FAILED
|
||||
STATUS_OPLOCK_BREAK_IN_PROCESS
|
||||
STATUS_OPLOCK_NOT_GRANTED
|
||||
STATUS_ORDINAL_NOT_FOUND
|
||||
STATUS_PAGEFILE_CREATE_FAILED
|
||||
STATUS_PAGEFILE_QUOTA
|
||||
STATUS_PAGEFILE_QUOTA_EXCEEDED
|
||||
STATUS_PARITY_ERROR
|
||||
STATUS_PARTIAL_COPY
|
||||
STATUS_PARTITION_FAILURE
|
||||
STATUS_PASSWORD_EXPIRED
|
||||
STATUS_PASSWORD_MUST_CHANGE
|
||||
STATUS_PASSWORD_RESTRICTION
|
||||
STATUS_PATH_NOT_COVERED
|
||||
STATUS_PENDING
|
||||
STATUS_PIPE_BROKEN
|
||||
STATUS_PIPE_BUSY
|
||||
STATUS_PIPE_CLOSING
|
||||
STATUS_PIPE_CONNECTED
|
||||
STATUS_PIPE_DISCONNECTED
|
||||
STATUS_PIPE_EMPTY
|
||||
STATUS_PIPE_LISTENING
|
||||
STATUS_PIPE_NOT_AVAILABLE
|
||||
STATUS_PLUGPLAY_NO_DEVICE
|
||||
STATUS_PORT_ALREADY_SET
|
||||
STATUS_PORT_CONNECTION_REFUSED
|
||||
STATUS_PORT_DISCONNECTED
|
||||
STATUS_PORT_MESSAGE_TOO_LONG
|
||||
STATUS_PORT_UNREACHABLE
|
||||
STATUS_POSSIBLE_DEADLOCK
|
||||
STATUS_PREDEFINED_HANDLE
|
||||
STATUS_PRIMARY_TRANSPORT_CONNECT_FAILED
|
||||
STATUS_PRINT_CANCELLED
|
||||
STATUS_PRINT_QUEUE_FULL
|
||||
STATUS_PRIVILEGED_INSTRUCTION
|
||||
STATUS_PRIVILEGE_NOT_HELD
|
||||
STATUS_PROCEDURE_NOT_FOUND
|
||||
STATUS_PROCESS_IN_JOB
|
||||
STATUS_PROCESS_IS_TERMINATING
|
||||
STATUS_PROCESS_NOT_IN_JOB
|
||||
STATUS_PROFILING_AT_LIMIT
|
||||
STATUS_PROFILING_NOT_STARTED
|
||||
STATUS_PROFILING_NOT_STOPPED
|
||||
STATUS_PROPSET_NOT_FOUND
|
||||
STATUS_PROTOCOL_UNREACHABLE
|
||||
STATUS_PWD_HISTORY_CONFLICT
|
||||
STATUS_PWD_TOO_RECENT
|
||||
STATUS_PWD_TOO_SHORT
|
||||
STATUS_QUOTA_EXCEEDED
|
||||
STATUS_QUOTA_LIST_INCONSISTENT
|
||||
STATUS_RANGE_LIST_CONFLICT
|
||||
STATUS_RANGE_NOT_FOUND
|
||||
STATUS_RANGE_NOT_LOCKED
|
||||
STATUS_RECEIVE_EXPEDITED
|
||||
STATUS_RECEIVE_PARTIAL
|
||||
STATUS_RECEIVE_PARTIAL_EXPEDITED
|
||||
STATUS_RECOVERY_FAILURE
|
||||
STATUS_REDIRECTOR_HAS_OPEN_HANDLES
|
||||
STATUS_REDIRECTOR_NOT_STARTED
|
||||
STATUS_REDIRECTOR_PAUSED
|
||||
STATUS_REDIRECTOR_STARTED
|
||||
STATUS_REGISTRY_CORRUPT
|
||||
STATUS_REGISTRY_IO_FAILED
|
||||
STATUS_REGISTRY_QUOTA_LIMIT
|
||||
STATUS_REGISTRY_RECOVERED
|
||||
STATUS_REMOTE_DISCONNECT
|
||||
STATUS_REMOTE_NOT_LISTENING
|
||||
STATUS_REMOTE_RESOURCES
|
||||
STATUS_REMOTE_SESSION_LIMIT
|
||||
STATUS_REPARSE
|
||||
STATUS_REPLY_MESSAGE_MISMATCH
|
||||
STATUS_REQUEST_ABORTED
|
||||
STATUS_REQUEST_NOT_ACCEPTED
|
||||
STATUS_RESOURCE_DATA_NOT_FOUND
|
||||
STATUS_RESOURCE_LANG_NOT_FOUND
|
||||
STATUS_RESOURCE_NAME_NOT_FOUND
|
||||
STATUS_RESOURCE_NOT_OWNED
|
||||
STATUS_RESOURCE_TYPE_NOT_FOUND
|
||||
STATUS_RETRY
|
||||
STATUS_REVISION_MISMATCH
|
||||
STATUS_RXACT_COMMITTED
|
||||
STATUS_RXACT_COMMIT_FAILURE
|
||||
STATUS_RXACT_COMMIT_NECESSARY
|
||||
STATUS_RXACT_INVALID_STATE
|
||||
STATUS_RXACT_STATE_CREATED
|
||||
STATUS_SAM_INIT_FAILURE
|
||||
STATUS_SECRET_TOO_LONG
|
||||
STATUS_SECTION_NOT_EXTENDED
|
||||
STATUS_SECTION_NOT_IMAGE
|
||||
STATUS_SECTION_PROTECTION
|
||||
STATUS_SECTION_TOO_BIG
|
||||
STATUS_SEGMENT_NOTIFICATION
|
||||
STATUS_SEMAPHORE_LIMIT_EXCEEDED
|
||||
STATUS_SERIAL_COUNTER_TIMEOUT
|
||||
STATUS_SERIAL_MORE_WRITES
|
||||
STATUS_SERIAL_NO_DEVICE_INITED
|
||||
STATUS_SERVER_DISABLED
|
||||
STATUS_SERVER_HAS_OPEN_HANDLES
|
||||
STATUS_SERVER_NOT_DISABLED
|
||||
STATUS_SERVICE_NOTIFICATION
|
||||
STATUS_SETMARK_DETECTED
|
||||
STATUS_SHARED_IRQ_BUSY
|
||||
STATUS_SHARING_PAUSED
|
||||
STATUS_SHARING_VIOLATION
|
||||
STATUS_SINGLE_STEP
|
||||
STATUS_SOME_NOT_MAPPED
|
||||
STATUS_SPECIAL_ACCOUNT
|
||||
STATUS_SPECIAL_GROUP
|
||||
STATUS_SPECIAL_USER
|
||||
STATUS_STACK_OVERFLOW
|
||||
STATUS_STACK_OVERFLOW_READ
|
||||
STATUS_SUCCESS
|
||||
STATUS_SUSPEND_COUNT_EXCEEDED
|
||||
STATUS_SYNCHRONIZATION_REQUIRED
|
||||
STATUS_SYSTEM_PROCESS_TERMINATED
|
||||
STATUS_THREAD_IS_TERMINATING
|
||||
STATUS_THREAD_NOT_IN_PROCESS
|
||||
STATUS_THREAD_WAS_SUSPENDED
|
||||
STATUS_TIMEOUT
|
||||
STATUS_TIMER_NOT_CANCELED
|
||||
STATUS_TIMER_RESOLUTION_NOT_SET
|
||||
STATUS_TIMER_RESUME_IGNORED
|
||||
STATUS_TIME_DIFFERENCE_AT_DC
|
||||
STATUS_TOKEN_ALREADY_IN_USE
|
||||
STATUS_TOO_LATE
|
||||
STATUS_TOO_MANY_ADDRESSES
|
||||
STATUS_TOO_MANY_COMMANDS
|
||||
STATUS_TOO_MANY_CONTEXT_IDS
|
||||
STATUS_TOO_MANY_GUIDS_REQUESTED
|
||||
STATUS_TOO_MANY_LINKS
|
||||
STATUS_TOO_MANY_LUIDS_REQUESTED
|
||||
STATUS_TOO_MANY_NAMES
|
||||
STATUS_TOO_MANY_NODES
|
||||
STATUS_TOO_MANY_OPENED_FILES
|
||||
STATUS_TOO_MANY_PAGING_FILES
|
||||
STATUS_TOO_MANY_SECRETS
|
||||
STATUS_TOO_MANY_SESSIONS
|
||||
STATUS_TOO_MANY_SIDS
|
||||
STATUS_TOO_MANY_THREADS
|
||||
STATUS_TRANSACTION_ABORTED
|
||||
STATUS_TRANSACTION_INVALID_ID
|
||||
STATUS_TRANSACTION_INVALID_TYPE
|
||||
STATUS_TRANSACTION_NO_MATCH
|
||||
STATUS_TRANSACTION_NO_RELEASE
|
||||
STATUS_TRANSACTION_RESPONDED
|
||||
STATUS_TRANSACTION_TIMED_OUT
|
||||
STATUS_TRUSTED_DOMAIN_FAILURE
|
||||
STATUS_TRUSTED_RELATIONSHIP_FAILURE
|
||||
STATUS_TRUST_FAILURE
|
||||
STATUS_UNABLE_TO_DECOMMIT_VM
|
||||
STATUS_UNABLE_TO_DELETE_SECTION
|
||||
STATUS_UNABLE_TO_FREE_VM
|
||||
STATUS_UNABLE_TO_LOCK_MEDIA
|
||||
STATUS_UNABLE_TO_UNLOAD_MEDIA
|
||||
STATUS_UNDEFINED_CHARACTER
|
||||
STATUS_UNEXPECTED_IO_ERROR
|
||||
STATUS_UNEXPECTED_MM_CREATE_ERR
|
||||
STATUS_UNEXPECTED_MM_EXTEND_ERR
|
||||
STATUS_UNEXPECTED_MM_MAP_ERROR
|
||||
STATUS_UNEXPECTED_NETWORK_ERROR
|
||||
STATUS_UNHANDLED_EXCEPTION
|
||||
STATUS_UNKNOWN_REVISION
|
||||
STATUS_UNMAPPABLE_CHARACTER
|
||||
STATUS_UNRECOGNIZED_MEDIA
|
||||
STATUS_UNRECOGNIZED_VOLUME
|
||||
STATUS_UNSUCCESSFUL
|
||||
STATUS_UNSUPPORTED_COMPRESSION
|
||||
STATUS_UNWIND
|
||||
STATUS_USER_APC
|
||||
STATUS_USER_EXISTS
|
||||
STATUS_USER_MAPPED_FILE
|
||||
STATUS_USER_SESSION_DELETED
|
||||
STATUS_VALIDATE_CONTINUE
|
||||
STATUS_VARIABLE_NOT_FOUND
|
||||
STATUS_VDM_HARD_ERROR
|
||||
STATUS_VERIFY_REQUIRED
|
||||
STATUS_VIRTUAL_CIRCUIT_CLOSED
|
||||
STATUS_VOLUME_DISMOUNTED
|
||||
STATUS_VOLUME_MOUNTED
|
||||
STATUS_WAIT_0
|
||||
STATUS_WAIT_63
|
||||
STATUS_WAKE_SYSTEM_DEBUGGER
|
||||
STATUS_WAS_LOCKED
|
||||
STATUS_WAS_UNLOCKED
|
||||
STATUS_WORKING_SET_LIMIT_RANGE
|
||||
STATUS_WORKING_SET_QUOTA
|
||||
STATUS_WRONG_PASSWORD
|
||||
STATUS_WRONG_PASSWORD_CORE
|
||||
STATUS_WRONG_VOLUME
|
||||
STATUS_WX86_BREAKPOINT
|
||||
STATUS_WX86_CONTINUE
|
||||
STATUS_WX86_CREATEWX86TIB
|
||||
STATUS_WX86_EXCEPTION_CHAIN
|
||||
STATUS_WX86_EXCEPTION_CONTINUE
|
||||
STATUS_WX86_EXCEPTION_LASTCHANCE
|
||||
STATUS_WX86_FLOAT_STACK_CHECK
|
||||
STATUS_WX86_INTERNAL_ERROR
|
||||
STATUS_WX86_SINGLE_STEP
|
||||
STATUS_WX86_UNSIMULATE
|
@@ -18,7 +18,7 @@ Don't you know going around dereferncing null pointers all day can be hazardous
|
||||
Well, duh!
|
||||
There's a bit in cr3 for problems like that.
|
||||
Just add a field to the %stru% to keep track of it!
|
||||
Don't worry about it... the garbage collector in the kernel will clean it up for you.
|
||||
Don't worry about it... the garbage collector in %module% will clean it up for you.
|
||||
Did I do that?
|
||||
Didn't %dev% fix that already?
|
||||
Yes, I think I've seen that bug before... no... that was another program.
|
||||
@@ -43,7 +43,7 @@ Hmm.. that seems to have been introduced by my last commit... I bet CVS mixed up
|
||||
It can't possibly be my fault, so I don't care.
|
||||
I'm not experiencing that problem, perhaps it's all in your mind.
|
||||
Well... like a good friend of mine said... "Don't Panic!"
|
||||
It just shows you how far ReactOS has come along! A year ago a bug like that wouldn't have even been possible!
|
||||
It just shows you how far ReactOS has come along! A %period% ago a bug like that wouldn't have even been possible!
|
||||
Just surround the code with an #if 0/#endif block, it solves all my problems!
|
||||
You know.. if %dev% would just finish %module% for us, we wouldn't be having this problem.
|
||||
I say we move on to the next function, since we can't seem to figure this one out.
|
||||
@@ -54,8 +54,20 @@ ask %dev%
|
||||
Thank you for that amazingly keen insight, Commander Obvious.
|
||||
Sorry, can't help you right now, trying to track down this bug %dev% caused in %module%
|
||||
I dont know about that, but I just fixed a problem in %module% for %dev%
|
||||
How should I know? I'm still trying to figure out this main() thing... ooh! wanna see what I did in the kernel?
|
||||
How should I know? I'm still trying to figure out this main() thing... ooh! wanna see what I did in %module%?
|
||||
lol!
|
||||
*wink*
|
||||
;)
|
||||
42
|
||||
It's gonna take me %period%s to fix all %dev%'s bugs in %module% :(
|
||||
It's gonna take me over %period% to fix all %dev%'s bugs in %module% :(
|
||||
How could %func% return %status%!? It bet %dev% broke it! I didn't touch it... honest! no.. really! (me hides)
|
||||
It's fine if you get %status% there ... just ignore the destruction, and call %func% instead.
|
||||
%dev% said %status% isn't really an error in this context because we expect %module% to be toast by now
|
||||
heh, I'm still trying to figure out why %func% is returning %status% when I call it from %module%...
|
||||
%dev% said it's okay to ignore that as long as you're below %irql%
|
||||
erm, what do you mean?
|
||||
damn, I do that all the time
|
||||
if you want a reply that sounds right, I'd say that %func% support for that is vital to the future of %module%
|
||||
Sounds like you're having a problem with %func%. I hate that thing... don't talk to me about it.
|
||||
Just return %status% and forget about it. Someone else will fix it, later.
|
||||
Blah blah blah... sheesh... can't you figure out *anything*?
|
1000
irc/ArchBlackmann/type.txt
Normal file
1000
irc/ArchBlackmann/type.txt
Normal file
File diff suppressed because it is too large
Load Diff
@@ -34,8 +34,8 @@ COMPONENTS = ntoskrnl
|
||||
HALS = halx86/up halx86/mp
|
||||
|
||||
# Bus drivers
|
||||
# acpi isapnp pci
|
||||
BUS = acpi isapnp pci
|
||||
# acpi isapnp pci serenum
|
||||
BUS = acpi isapnp pci serenum
|
||||
|
||||
# Filesystem libraries
|
||||
# vfatlib
|
||||
@@ -48,7 +48,7 @@ LIBUNICODE =
|
||||
LIB_STATIC = string rosrtl epsapi uuid libwine zlib rtl tgetopt pseh adns dxguid strmiids crt rossym wdmguid
|
||||
|
||||
# Keyboard layout libraries
|
||||
DLLS_KBD = kbdda kbddv kbdes kbdfr kbdgr kbdse kbduk kbdus
|
||||
DLLS_KBD = kbdda kbddv kbdes kbdfr kbdgr kbdru kbdse kbdsg kbduk kbdus
|
||||
|
||||
# Control Panels
|
||||
DLLS_CPL = cpl
|
||||
@@ -61,9 +61,10 @@ DLLS_SHELLEXT = shellext
|
||||
DLLS = acledit aclui advapi32 advpack cabinet cards comctl32 crtdll comdlg32 d3d8thk dbghelp expat fmifs freetype \
|
||||
gdi32 gdiplus glu32 hid imagehlp imm32 iphlpapi kernel32 lzexpand mesa32 midimap mmdrv mpr msacm msafd \
|
||||
msgina msi msimg32 msvcrt20 msvideo mswsock netapi32 ntdll ole32 oleaut32 oledlg olepro32 opengl32 \
|
||||
packet psapi riched20 richedit rpcrt4 samlib secur32 setupapi shell32 shlwapi smlib smdll snmpapi \
|
||||
packet psapi riched20 richedit rpcrt4 samlib secur32 serialui setupapi shell32 shlwapi smlib smdll snmpapi \
|
||||
syssetup twain user32 userenv version wininet winmm winspool ws2help ws2_32 wsock32 wshirda dnsapi \
|
||||
urlmon shdocvw dinput dinput8 dxdiagn devenum dsound lsasrv $(DLLS_KBD) $(DLLS_CPL) $(DLLS_SHELLEXT)
|
||||
urlmon shdocvw dinput dinput8 dxdiagn devenum dsound lsasrv dhcpcapi \
|
||||
$(DLLS_KBD) $(DLLS_CPL) $(DLLS_SHELLEXT)
|
||||
|
||||
SUBSYS = smss win32k csrss ntvdm
|
||||
|
||||
@@ -105,7 +106,7 @@ STORAGE_DRIVERS = atapi cdrom class2 disk floppy scsiport diskdump
|
||||
# autochk cmd format services setup usetup welcome winlogon msiexec
|
||||
SYS_APPS = autochk calc cmd explorer expand format ibrowser msiexec regsvr32 \
|
||||
reporterror services setup taskmgr userinit usetup welcome vmwinst rundll32 \
|
||||
winlogon regedit winefile notepad reactos lsass
|
||||
winlogon regedit winefile notepad reactos lsass dhcp
|
||||
|
||||
# System services
|
||||
SYS_SVC = rpcss eventlog umpnpmgr
|
||||
|
@@ -11,7 +11,7 @@ TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = loadlib
|
||||
|
||||
TARGET_CFLAGS = -Wall -Werror -D_USE_W32API -DUNICODE -D_UNICODE
|
||||
TARGET_CFLAGS = -Wall -Werror -D__USE_W32API -DUNICODE -D_UNICODE
|
||||
|
||||
TARGET_SDKLIBS = kernel32.a ntdll.a
|
||||
|
||||
|
@@ -9,7 +9,7 @@ include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
# Console system utilities
|
||||
# cabman cat net objdir partinfo pice ps sc stats
|
||||
UTIL_APPS = cat objdir partinfo pnpdump sc shutdown stats tickcount ps
|
||||
UTIL_APPS = cat objdir pnpdump sc shutdown stats tickcount ps
|
||||
|
||||
UTIL_NET_APPS = arp finger ftp ipconfig netstat ping route telnet whois
|
||||
|
||||
|
@@ -56,14 +56,14 @@ netfinger(char *name)
|
||||
struct hostent *hp, def;
|
||||
struct servent *sp;
|
||||
struct sockaddr_in sin;
|
||||
int s;
|
||||
SOCKET s;
|
||||
char *alist[1], *host;
|
||||
|
||||
/* If this is a local request */
|
||||
if (!(host = rindex(name, '@')))
|
||||
return;
|
||||
|
||||
*host++ = NULL;
|
||||
*host++ = '\0';
|
||||
if (isdigit(*host) && (defaddr.s_addr = inet_addr(host)) != -1) {
|
||||
def.h_name = host;
|
||||
def.h_addr_list = alist;
|
||||
@@ -84,7 +84,7 @@ netfinger(char *name)
|
||||
sin.sin_family = hp->h_addrtype;
|
||||
bcopy(hp->h_addr, (char *)&sin.sin_addr, hp->h_length);
|
||||
sin.sin_port = sp->s_port;
|
||||
if ((s = socket(hp->h_addrtype, SOCK_STREAM, 0)) < 0) {
|
||||
if ((s = socket(hp->h_addrtype, SOCK_STREAM, 0)) == INVALID_SOCKET) {
|
||||
perror("finger: socket");
|
||||
return;
|
||||
}
|
||||
|
@@ -235,7 +235,7 @@ char *getpass (const char * prompt)
|
||||
static char input[256];
|
||||
HANDLE in;
|
||||
HANDLE err;
|
||||
int count;
|
||||
DWORD count;
|
||||
|
||||
in = GetStdHandle (STD_INPUT_HANDLE);
|
||||
err = GetStdHandle (STD_ERROR_HANDLE);
|
||||
|
@@ -97,7 +97,7 @@ uid_t getuid();
|
||||
sig_t lostpeer();
|
||||
off_t restart_point = 0;
|
||||
|
||||
int cin, cout;
|
||||
SOCKET cin, cout;
|
||||
int dataconn(char *mode);
|
||||
|
||||
int command(char *fmt, ...);
|
||||
@@ -113,7 +113,8 @@ void psabort(int sig);
|
||||
char *hookup(char *host, int port)
|
||||
{
|
||||
register struct hostent *hp = 0;
|
||||
int s,len;
|
||||
int len;
|
||||
SOCKET s;
|
||||
static char hostnamebuf[80];
|
||||
|
||||
bzero((char *)&hisctladdr, sizeof (hisctladdr));
|
||||
@@ -136,7 +137,7 @@ char *hookup(char *host, int port)
|
||||
}
|
||||
hostname = hostnamebuf;
|
||||
s = socket(hisctladdr.sin_family, SOCK_STREAM, 0);
|
||||
if (s < 0) {
|
||||
if (s == INVALID_SOCKET) {
|
||||
perror("ftp: socket");
|
||||
code = -1;
|
||||
return (0);
|
||||
@@ -1327,8 +1328,8 @@ void pswitch(int flag)
|
||||
char name[MAXHOSTNAMELEN];
|
||||
struct sockaddr_in mctl;
|
||||
struct sockaddr_in hctl;
|
||||
FILE *in;
|
||||
FILE *out;
|
||||
SOCKET in;
|
||||
SOCKET out;
|
||||
int tpe;
|
||||
int cpnd;
|
||||
int sunqe;
|
||||
@@ -1371,10 +1372,10 @@ void pswitch(int flag)
|
||||
hisctladdr = op->hctl;
|
||||
ip->mctl = myctladdr;
|
||||
myctladdr = op->mctl;
|
||||
(int) ip->in = cin; // What the hell am I looking at...?
|
||||
cin = (int) op->in;
|
||||
(int) ip->out = cout; // Same again...
|
||||
cout = (int) op->out;
|
||||
ip->in = cin;
|
||||
cin = op->in;
|
||||
ip->out = cout;
|
||||
cout = op->out;
|
||||
ip->tpe = type;
|
||||
type = op->tpe;
|
||||
if (!type)
|
||||
|
@@ -8,6 +8,8 @@ TARGET_NAME = ftp
|
||||
|
||||
TARGET_INSTALLDIR = system32
|
||||
|
||||
TARGET_CFLAGS = -D__USE_W32API
|
||||
|
||||
TARGET_SDKLIBS = ws2_32.a iphlpapi.a
|
||||
# ntdll.a
|
||||
|
||||
|
@@ -8,7 +8,7 @@ TARGET_NAME = ping
|
||||
|
||||
TARGET_INSTALLDIR = system32
|
||||
|
||||
TARGET_CFLAGS = -D__USE_W32_SOCKETS
|
||||
TARGET_CFLAGS = -D__USE_W32API -D__USE_W32_SOCKETS
|
||||
|
||||
TARGET_SDKLIBS = ws2_32.a
|
||||
|
||||
|
@@ -12,7 +12,7 @@ TARGET_SDKLIBS = ws2_32.a iphlpapi.a ntdll.a
|
||||
|
||||
TARGET_OBJECTS = $(TARGET_NAME).o
|
||||
|
||||
TARGET_GCCLIBS =
|
||||
TARGET_CFLAGS = -D__USE_W32API
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
|
@@ -10,7 +10,7 @@ TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = partinfo
|
||||
|
||||
TARGET_CFLAGS = -Wall -Werror -Wno-format
|
||||
TARGET_CFLAGS = -D__USE_W32API -Wall -Werror -Wno-format
|
||||
|
||||
TARGET_SDKLIBS = ntdll.a kernel32.a
|
||||
|
||||
|
@@ -8,9 +8,11 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
|
||||
//#define DUMP_DATA
|
||||
#define DUMP_SIZE_INFO
|
||||
|
||||
#define UNICODE
|
||||
|
||||
#ifdef DUMP_DATA
|
||||
void HexDump(char *buffer, ULONG size)
|
||||
|
@@ -10,7 +10,7 @@ TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = pnpdump
|
||||
|
||||
TARGET_CFLAGS = -Wall -Werror
|
||||
TARGET_CFLAGS = -D__USE_W32API -Wall -Werror
|
||||
|
||||
TARGET_SDKLIBS = ntdll.a kernel32.a
|
||||
|
||||
|
@@ -8,6 +8,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <conio.h>
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
|
||||
#include <pshpack1.h>
|
||||
|
||||
typedef struct _CM_PNP_BIOS_DEVICE_NODE
|
||||
|
@@ -10,7 +10,7 @@ TARGET_APPTYPE = console
|
||||
|
||||
TARGET_NAME = ps
|
||||
|
||||
TARGET_CFLAGS = -DANONYMOUSUNIONS -Werror -Wall
|
||||
TARGET_CFLAGS = -D__USE_W32API -DANONYMOUSUNIONS -Werror -Wall
|
||||
|
||||
TARGET_SDKLIBS = ntdll.a kernel32.a user32.a
|
||||
|
||||
|
@@ -110,8 +110,8 @@ int main()
|
||||
DWORD r;
|
||||
ANSI_STRING astring;
|
||||
HANDLE stdout = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
PSYSTEM_PROCESSES SystemProcesses = NULL;
|
||||
PSYSTEM_PROCESSES CurrentProcess;
|
||||
PSYSTEM_PROCESS_INFORMATION SystemProcesses = NULL;
|
||||
PSYSTEM_PROCESS_INFORMATION CurrentProcess;
|
||||
ULONG BufferSize, ReturnSize;
|
||||
NTSTATUS Status;
|
||||
char buf[256];
|
||||
@@ -140,7 +140,7 @@ int main()
|
||||
|
||||
/* For every process print the information. */
|
||||
CurrentProcess = SystemProcesses;
|
||||
while (CurrentProcess->NextEntryDelta != 0)
|
||||
while (CurrentProcess->NextEntryOffset != 0)
|
||||
{
|
||||
int hour, hour1, thour, thour1;
|
||||
unsigned char minute, minute1, tmin, tmin1;
|
||||
@@ -159,53 +159,53 @@ int main()
|
||||
minute1 = (ptime.QuadPart / (10000000LL * 60LL)) % 60LL;
|
||||
seconds1 = (ptime.QuadPart / 10000000LL) % 60LL;
|
||||
|
||||
RtlUnicodeStringToAnsiString(&astring, &CurrentProcess->ProcessName, TRUE);
|
||||
RtlUnicodeStringToAnsiString(&astring, &CurrentProcess->ImageName, TRUE);
|
||||
|
||||
wsprintf(buf,"P%8d %8d %3d:%02d:%02d %3d:%02d:%02d ProcName: %s\n",
|
||||
CurrentProcess->ProcessId, CurrentProcess->InheritedFromProcessId,
|
||||
CurrentProcess->UniqueProcessId, CurrentProcess->InheritedFromUniqueProcessId,
|
||||
hour, minute, seconds, hour1, minute1, seconds1,
|
||||
astring.Buffer);
|
||||
WriteFile(stdout, buf, lstrlen(buf), &r, NULL);
|
||||
|
||||
RtlFreeAnsiString(&astring);
|
||||
|
||||
for (ti = 0; ti < CurrentProcess->ThreadCount; ti++)
|
||||
for (ti = 0; ti < CurrentProcess->NumberOfThreads; ti++)
|
||||
{
|
||||
struct status *statt;
|
||||
struct waitres *waitt;
|
||||
char szWindowName[30] = {" "};
|
||||
|
||||
ptime = CurrentProcess->Threads[ti].KernelTime;
|
||||
ptime = CurrentProcess->TH[ti].KernelTime;
|
||||
thour = (ptime.QuadPart / (10000000LL * 3600LL));
|
||||
tmin = (ptime.QuadPart / (10000000LL * 60LL)) % 60LL;
|
||||
tsec = (ptime.QuadPart / 10000000LL) % 60LL;
|
||||
|
||||
ptime = CurrentProcess->Threads[ti].UserTime;
|
||||
ptime = CurrentProcess->TH[ti].UserTime;
|
||||
thour1 = (ptime.QuadPart / (10000000LL * 3600LL));
|
||||
tmin1 = (ptime.QuadPart / (10000000LL * 60LL)) % 60LL;
|
||||
tsec1 = (ptime.QuadPart / 10000000LL) % 60LL;
|
||||
|
||||
statt = thread_stat;
|
||||
while (statt->state != CurrentProcess->Threads[ti].State && statt->state >= 0)
|
||||
while (statt->state != CurrentProcess->TH[ti].ThreadState && statt->state >= 0)
|
||||
statt++;
|
||||
|
||||
waitt = waitreason;
|
||||
while (waitt->state != CurrentProcess->Threads[ti].WaitReason && waitt->state >= 0)
|
||||
while (waitt->state != CurrentProcess->TH[ti].WaitReason && waitt->state >= 0)
|
||||
waitt++;
|
||||
|
||||
wsprintf (buf1,
|
||||
"t% %8d %3d:%02d:%02d %3d:%02d:%02d %s %s\n",
|
||||
CurrentProcess->Threads[ti].ClientId.UniqueThread,
|
||||
CurrentProcess->TH[ti].ClientId.UniqueThread,
|
||||
thour, tmin, tsec, thour1, tmin1, tsec1,
|
||||
statt->desc , waitt->desc);
|
||||
WriteFile(stdout, buf1, lstrlen(buf1), &r, NULL);
|
||||
|
||||
EnumThreadWindows((DWORD)CurrentProcess->Threads[ti].ClientId.UniqueThread,
|
||||
EnumThreadWindows((DWORD)CurrentProcess->TH[ti].ClientId.UniqueThread,
|
||||
(ENUMWINDOWSPROC) EnumThreadProc,
|
||||
(LPARAM)(LPTSTR) szWindowName );
|
||||
}
|
||||
CurrentProcess = (PSYSTEM_PROCESSES)((ULONG_PTR)CurrentProcess +
|
||||
CurrentProcess->NextEntryDelta);
|
||||
CurrentProcess = (PSYSTEM_PROCESS_INFORMATION)((ULONG_PTR)CurrentProcess +
|
||||
CurrentProcess->NextEntryOffset);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
@@ -13,7 +13,7 @@ TARGET_INSTALLDIR = system32
|
||||
|
||||
TARGET_NAME = sc
|
||||
|
||||
TARGET_CFLAGS = -DDBG -Werror -Wall
|
||||
TARGET_CFLAGS = -D__USE_W32API -DDBG -Werror -Wall
|
||||
|
||||
TARGET_SDKLIBS = kernel32.a ntdll.a advapi32.a
|
||||
|
||||
|
@@ -14,6 +14,7 @@ TARGET_BASE_LIB_DSOUND =0x50000000
|
||||
TARGET_BASE_LIB_GLU32 =0x50000000
|
||||
TARGET_BASE_LIB_OPENGL32 =0x50000000
|
||||
TARGET_BASE_LIB_EXT_SLAYER =0x5C7E0000
|
||||
TARGET_BASE_LIB_SERIALUI =0x5CDA0000
|
||||
TARGET_BASE_LIB_DINPUT =0x5F580000
|
||||
TARGET_BASE_LIB_CPL_TIMEDATE =0x64DA0000
|
||||
TARGET_BASE_LIB_CPL_SYSDM =0x64DD0000
|
||||
@@ -67,8 +68,8 @@ TARGET_BASE_LIB_SETUPAPI =0x76660000
|
||||
TARGET_BASE_LIB_GDIPLUS =0x76a00000
|
||||
TARGET_BASE_LIB_IMAGEHLP =0x76c90000
|
||||
TARGET_BASE_LIB_FMIFS =0x76df0000
|
||||
TARGET_BASE_LIB_SHELL32 =0x77260000
|
||||
TARGET_BASE_LIB_IPHLPAPI =0x77300000
|
||||
TARGET_BASE_LIB_SHELL32 =0x77200000
|
||||
TARGET_BASE_LIB_IPHLPAPI =0x77380000
|
||||
TARGET_BASE_LIB_MSACM =0x77400000
|
||||
TARGET_BASE_LIB_MMDRV =0x77500000
|
||||
TARGET_BASE_LIB_CRTDLL =0x77630000
|
||||
@@ -86,8 +87,8 @@ TARGET_BASE_LIB_OLE32 =0x77a50000
|
||||
TARGET_BASE_LIB_OLEPRO32 =0x77a50000
|
||||
TARGET_BASE_LIB_VERSION =0x77a90000
|
||||
TARGET_BASE_LIB_ADVAPI32 =0x77dc0000
|
||||
TARGET_BASE_LIB_USER32 =0x77e60000
|
||||
TARGET_BASE_LIB_GDI32 =0x77ed0000
|
||||
TARGET_BASE_LIB_USER32 =0x77e50000
|
||||
TARGET_BASE_LIB_GDI32 =0x77ee0000
|
||||
TARGET_BASE_LIB_DNSAPI =0x77f00000
|
||||
TARGET_BASE_LIB_MSVCRT =0x78000000
|
||||
TARGET_BASE_LIB_MSVCRT20 =0x78500000
|
||||
|
@@ -20,6 +20,7 @@
|
||||
PATH_TO_TOP = ../..
|
||||
|
||||
include rules.mak
|
||||
include $(PATH_TO_TOP)/config
|
||||
|
||||
all:
|
||||
$(MAKE) -C tools
|
||||
@@ -29,7 +30,7 @@ all:
|
||||
$(MAKE) -C fdebug
|
||||
|
||||
test:
|
||||
|
||||
|
||||
clean:
|
||||
$(MAKE) -C bootsect clean
|
||||
$(MAKE) -C freeldr clean
|
||||
@@ -38,6 +39,7 @@ clean:
|
||||
$(MAKE) -C tools clean
|
||||
|
||||
bootcd:
|
||||
ifeq ($(ARCH),i386)
|
||||
$(CP) bootsect/isoboot.bin ${BOOTCD_DIR}/../isoboot.bin
|
||||
$(CP) bootsect/dosmbr.bin ${BOOTCD_DIR}/loader/dosmbr.bin
|
||||
$(CP) bootsect/ext2.bin ${BOOTCD_DIR}/loader/ext2.bin
|
||||
@@ -46,5 +48,7 @@ bootcd:
|
||||
$(CP) bootsect/isoboot.bin ${BOOTCD_DIR}/loader/isoboot.bin
|
||||
$(CP) freeldr/freeldr.sys ${BOOTCD_DIR}/loader/freeldr.sys
|
||||
$(CP) freeldr/setupldr.sys ${BOOTCD_DIR}/loader/setupldr.sys
|
||||
endif
|
||||
|
||||
.PHONY : clean
|
||||
|
||||
|
@@ -25,56 +25,8 @@ BOOTCD_DIR = $(PATH_TO_TOP)/../bootcd
|
||||
|
||||
.PHONY : clean bootcd
|
||||
|
||||
all: $(BIN2C) dosmbr.bin fat.bin fat32.bin isoboot.bin ext2.bin
|
||||
|
||||
|
||||
$(BIN2C) :
|
||||
@$(MAKE) --no-print-directory -C $(FREELDR_TOOLS_PATH)
|
||||
|
||||
dosmbr.bin : dosmbr.asm
|
||||
@echo freeldr: Assembling dosmbr
|
||||
@$(NASM_CMD) $(NFLAGS) -o dosmbr.bin -f bin dosmbr.asm
|
||||
|
||||
fat.bin : fat.asm $(BIN2C)
|
||||
@echo freeldr: Assembling fat
|
||||
@$(NASM_CMD) $(NFLAGS) -o fat.bin -f bin fat.asm
|
||||
@$(BIN2C) fat.bin fat.h fat_data
|
||||
|
||||
|
||||
fat32.bin : fat32.asm $(BIN2C)
|
||||
@echo freeldr: Assembling fat32
|
||||
@$(NASM_CMD) $(NFLAGS) -o fat32.bin -f bin fat32.asm
|
||||
@$(BIN2C) fat32.bin fat32.h fat32_data
|
||||
|
||||
isoboot.bin : isoboot.asm
|
||||
@echo freeldr: Assembling isoboot
|
||||
@$(NASM_CMD) $(NFLAGS) -o isoboot.bin -f bin isoboot.asm
|
||||
|
||||
ext2.bin : ext2.asm
|
||||
@echo freeldr: Assembling ext2
|
||||
@$(NASM_CMD) $(NFLAGS) -o ext2.bin -f bin ext2.asm
|
||||
@$(BIN2C) ext2.bin ext2.h ext2_data
|
||||
|
||||
|
||||
.PHONY : bootcd
|
||||
bootcd: bootcd_dirs isoboot.bin
|
||||
$(CP) isoboot.bin $(BOOTCD_DIR)
|
||||
$(CP) dosmbr.bin $(BOOTCD_DIR)/disk/loader
|
||||
$(CP) ext2.bin $(BOOTCD_DIR)/disk/loader
|
||||
$(CP) fat.bin $(BOOTCD_DIR)/disk/loader
|
||||
$(CP) fat32.bin $(BOOTCD_DIR)/disk/loader
|
||||
$(CP) isoboot.bin $(BOOTCD_DIR)/disk/loader
|
||||
|
||||
.PHONY : bootcd_dirs
|
||||
bootcd_dirs:
|
||||
$(MKDIR) $(BOOTCD_DIR)
|
||||
$(MKDIR) $(BOOTCD_DIR)/disk
|
||||
$(MKDIR) $(BOOTCD_DIR)/disk/reactos
|
||||
$(MKDIR) $(BOOTCD_DIR)/disk/install
|
||||
$(MKDIR) $(BOOTCD_DIR)/disk/bootdisk
|
||||
$(MKDIR) $(BOOTCD_DIR)/disk/loader
|
||||
|
||||
clean:
|
||||
@-$(RM) *.bin
|
||||
@-$(RM) *.h
|
||||
@echo freeldr: Clean ALL done.
|
||||
ifeq ($(ARCH),powerpc)
|
||||
include Makefile.powerpc
|
||||
else
|
||||
include Makefile.i386
|
||||
endif
|
||||
|
52
reactos/boot/freeldr/bootsect/Makefile.i386
Normal file
52
reactos/boot/freeldr/bootsect/Makefile.i386
Normal file
@@ -0,0 +1,52 @@
|
||||
all: $(BIN2C) dosmbr.bin fat.bin fat32.bin isoboot.bin ext2.bin
|
||||
|
||||
$(BIN2C) :
|
||||
@$(MAKE) --no-print-directory -C $(FREELDR_TOOLS_PATH)
|
||||
|
||||
dosmbr.bin : dosmbr.asm
|
||||
@echo ===================================================== Assembling dosmbr
|
||||
@$(NASM_CMD) $(NFLAGS) -o dosmbr.bin -f bin dosmbr.asm
|
||||
|
||||
fat.bin : fat.asm $(BIN2C)
|
||||
@echo ===================================================== Assembling fat
|
||||
@$(NASM_CMD) $(NFLAGS) -o fat.bin -f bin fat.asm
|
||||
@$(BIN2C) fat.bin fat.h fat_data
|
||||
|
||||
|
||||
fat32.bin : fat32.asm $(BIN2C)
|
||||
@echo ===================================================== Assembling fat32
|
||||
@$(NASM_CMD) $(NFLAGS) -o fat32.bin -f bin fat32.asm
|
||||
@$(BIN2C) fat32.bin fat32.h fat32_data
|
||||
|
||||
isoboot.bin : isoboot.asm
|
||||
@echo ===================================================== Assembling isoboot
|
||||
@$(NASM_CMD) $(NFLAGS) -o isoboot.bin -f bin isoboot.asm
|
||||
|
||||
ext2.bin : ext2.asm
|
||||
@echo ===================================================== Assembling ext2
|
||||
@$(NASM_CMD) $(NFLAGS) -o ext2.bin -f bin ext2.asm
|
||||
@$(BIN2C) ext2.bin ext2.h ext2_data
|
||||
|
||||
|
||||
.PHONY : bootcd
|
||||
bootcd: bootcd_dirs isoboot.bin
|
||||
$(CP) isoboot.bin $(BOOTCD_DIR)
|
||||
$(CP) dosmbr.bin $(BOOTCD_DIR)/disk/loader
|
||||
$(CP) ext2.bin $(BOOTCD_DIR)/disk/loader
|
||||
$(CP) fat.bin $(BOOTCD_DIR)/disk/loader
|
||||
$(CP) fat32.bin $(BOOTCD_DIR)/disk/loader
|
||||
$(CP) isoboot.bin $(BOOTCD_DIR)/disk/loader
|
||||
|
||||
.PHONY : bootcd_dirs
|
||||
bootcd_dirs:
|
||||
$(MKDIR) $(BOOTCD_DIR)
|
||||
$(MKDIR) $(BOOTCD_DIR)/disk
|
||||
$(MKDIR) $(BOOTCD_DIR)/disk/reactos
|
||||
$(MKDIR) $(BOOTCD_DIR)/disk/install
|
||||
$(MKDIR) $(BOOTCD_DIR)/disk/bootdisk
|
||||
$(MKDIR) $(BOOTCD_DIR)/disk/loader
|
||||
|
||||
clean:
|
||||
@-$(RM) *.bin
|
||||
@-$(RM) *.h
|
||||
@echo Clean ALL done.
|
35
reactos/boot/freeldr/bootsect/Makefile.powerpc
Normal file
35
reactos/boot/freeldr/bootsect/Makefile.powerpc
Normal file
@@ -0,0 +1,35 @@
|
||||
TOOLS=$(PATH_TO_TOP)/tools
|
||||
SECTIONS= \
|
||||
--only-section=.text \
|
||||
--only-section=.data \
|
||||
--only-section=.bss
|
||||
LDSECT= -Ttext 0xe00000 -Tdata 0xe10000
|
||||
OBJS=ofwboot.o freeldr.o
|
||||
CFLAGS=-mbig -meabi -fPIC -fno-builtin -I../freeldr/include
|
||||
FREELDR=../freeldr/freeldr.sys
|
||||
|
||||
.SUFFIXES: .c .o
|
||||
|
||||
all: ofwldr
|
||||
|
||||
hack-coff$(EXEEXT):
|
||||
$(HOST_CC) -I../freeldr/include hack-coff.c -o $@
|
||||
|
||||
ofwboot.o: ofwboot.s
|
||||
$(NASM_CMD) $< -c -o $@
|
||||
|
||||
$(FREELDR):
|
||||
$(MAKE) -C ../freeldr
|
||||
|
||||
freeldr.o: $(FREELDR)
|
||||
$(TOOLS)/ppc-le2be $< freeldr.tmp
|
||||
$(OBJCOPY) -I binary -O elf32-powerpc -B powerpc:common freeldr.tmp $@
|
||||
rm freeldr.tmp
|
||||
|
||||
ofwldr: $(OBJS)
|
||||
$(LD) -melf32ppc --no-omagic $(LDSECT) $(OBJS) -g -o $@.elf
|
||||
$(OBJCOPY) $(SECTIONS) -O aixcoff-rs6000 $@.elf $@
|
||||
$(TOOLS)/hack-coff $@
|
||||
|
||||
clean:
|
||||
rm -rf ofwldr *.o *.elf *.tmp
|
@@ -89,9 +89,6 @@ main:
|
||||
mov es,ax ; Make ES correct
|
||||
|
||||
|
||||
cmp BYTE [BYTE bp+BootDrive],BYTE 0xff ; If they have specified a boot drive then use it
|
||||
jne GetDriveParameters
|
||||
|
||||
mov [BYTE bp+BootDrive],dl ; Save the boot drive
|
||||
|
||||
|
||||
|
960
reactos/boot/freeldr/bootsect/ofwboot.s
Normal file
960
reactos/boot/freeldr/bootsect/ofwboot.s
Normal file
@@ -0,0 +1,960 @@
|
||||
.section .text
|
||||
_start:
|
||||
.long 0xe00000 + 12
|
||||
.long 0
|
||||
.long 0
|
||||
|
||||
/*
|
||||
* LIFTED FROM arch/macppc/stand/ofwboot/Locore.c
|
||||
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
|
||||
* Copyright (C) 1995, 1996 TooLs GmbH.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by TooLs GmbH.
|
||||
* 4. The name of TooLs GmbH may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
_begin:
|
||||
sync
|
||||
isync
|
||||
|
||||
lis %r1,stack@ha
|
||||
addi %r1,%r1,stack@l
|
||||
addi %r1,%r1,16384 - 0x10
|
||||
|
||||
mfmsr %r8
|
||||
li %r0,0
|
||||
mtmsr %r0
|
||||
isync
|
||||
|
||||
mtibatu 0,%r0
|
||||
mtibatu 1,%r0
|
||||
mtibatu 2,%r0
|
||||
mtibatu 3,%r0
|
||||
mtdbatu 0,%r0
|
||||
mtdbatu 1,%r0
|
||||
mtdbatu 2,%r0
|
||||
mtdbatu 3,%r0
|
||||
|
||||
li %r9,0x12 /* BATL(0, BAT_M, BAT_PP_RW) */
|
||||
mtibatl 0,%r9
|
||||
mtdbatl 0,%r9
|
||||
li %r9,0x1ffe /* BATU(0, BAT_BL_256M, BAT_Vs) */
|
||||
mtibatu 0,%r9
|
||||
mtdbatu 0,%r9
|
||||
isync
|
||||
|
||||
li %r8,0x3030
|
||||
mtmsr %r8
|
||||
|
||||
/* Store ofw call addr */
|
||||
mr %r21,%r5
|
||||
lis %r10,0xe00000@ha
|
||||
stw %r5,ofw_call_addr - _start@l(%r10)
|
||||
|
||||
lis %r4,_binary_freeldr_tmp_end@ha
|
||||
addi %r4,%r4,_binary_freeldr_tmp_end@l
|
||||
lis %r3,_binary_freeldr_tmp_start@ha
|
||||
addi %r3,%r3,_binary_freeldr_tmp_start@l
|
||||
|
||||
lis %r5,0x8000@ha
|
||||
addi %r5,%r5,0x8000@l
|
||||
|
||||
bl copy_bits
|
||||
|
||||
bl zero_registers
|
||||
|
||||
lis %r3,0xe00000@ha
|
||||
addi %r3,%r3,freeldr_banner - _start
|
||||
|
||||
bl ofw_print_string
|
||||
|
||||
bl ofw_print_eol
|
||||
|
||||
/* Zero CTR */
|
||||
mtcr %r31
|
||||
|
||||
lis %r3,0x8000@ha
|
||||
addi %r3,%r3,0x8000@l
|
||||
|
||||
mtlr %r3
|
||||
|
||||
lis %r3,call_ofw@ha
|
||||
addi %r3,%r3,call_ofw - _start
|
||||
|
||||
b call_freeldr
|
||||
|
||||
.align 4
|
||||
call_freeldr:
|
||||
/* Get the address of the functions list --
|
||||
* Note:
|
||||
* Because of little endian switch we must use an even number of
|
||||
* instructions here.. Pad with a nop if needed. */
|
||||
mfmsr %r10
|
||||
ori %r10,%r10,1
|
||||
mtmsr %r10
|
||||
|
||||
nop
|
||||
|
||||
/* Note that this is little-endian from here on */
|
||||
blr
|
||||
nop
|
||||
|
||||
.align 4
|
||||
call_ofw:
|
||||
/* R3 has the function offset to call (n * 4)
|
||||
* Other arg registers are unchanged.
|
||||
* Note that these 4 instructions are in reverse order due to
|
||||
* little-endian convention */
|
||||
andi. %r0,%r0,65534
|
||||
mfmsr %r0
|
||||
mtmsr %r0
|
||||
/* Now normal ordering resumes */
|
||||
subi %r1,%r1,0x100
|
||||
|
||||
stw %r8,4(%r1)
|
||||
stw %r9,8(%r1)
|
||||
stw %r10,12(%r1)
|
||||
mflr %r8
|
||||
stw %r8,16(%r1)
|
||||
|
||||
lis %r10,0xe00000@ha
|
||||
add %r9,%r3,%r10
|
||||
lwz %r3,ofw_functions - _start@l(%r9)
|
||||
mtctr %r3
|
||||
|
||||
mr %r3,%r4
|
||||
mr %r4,%r5
|
||||
mr %r5,%r6
|
||||
mr %r6,%r7
|
||||
mr %r7,%r8
|
||||
|
||||
/* Goto the swapped function */
|
||||
bctrl
|
||||
|
||||
lwz %r8,16(%r1)
|
||||
mtlr %r8
|
||||
|
||||
lwz %r8,4(%r1)
|
||||
lwz %r9,8(%r1)
|
||||
lwz %r10,12(%r1)
|
||||
|
||||
addi %r1,%r1,0x100
|
||||
/* Ok, go back to little endian */
|
||||
mfmsr %r0
|
||||
ori %r0,%r0,1
|
||||
mtmsr %r0
|
||||
|
||||
/* Note that this is little-endian from here on */
|
||||
blr
|
||||
nop
|
||||
|
||||
zero_registers:
|
||||
xor %r2,%r2,%r2
|
||||
mr %r0,%r2
|
||||
mr %r3,%r2
|
||||
|
||||
mr %r4,%r2
|
||||
mr %r5,%r2
|
||||
mr %r6,%r2
|
||||
mr %r7,%r2
|
||||
|
||||
mr %r8,%r2
|
||||
mr %r9,%r2
|
||||
mr %r10,%r2
|
||||
mr %r11,%r2
|
||||
|
||||
mr %r12,%r2
|
||||
mr %r13,%r2
|
||||
mr %r14,%r2
|
||||
mr %r15,%r2
|
||||
|
||||
mr %r12,%r2
|
||||
mr %r13,%r2
|
||||
mr %r14,%r2
|
||||
mr %r15,%r2
|
||||
|
||||
mr %r16,%r2
|
||||
mr %r17,%r2
|
||||
mr %r18,%r2
|
||||
mr %r19,%r2
|
||||
|
||||
mr %r20,%r2
|
||||
mr %r21,%r2
|
||||
mr %r22,%r2
|
||||
mr %r23,%r2
|
||||
|
||||
mr %r24,%r2
|
||||
mr %r25,%r2
|
||||
mr %r26,%r2
|
||||
mr %r27,%r2
|
||||
|
||||
mr %r28,%r2
|
||||
mr %r29,%r2
|
||||
mr %r30,%r2
|
||||
mr %r31,%r2
|
||||
|
||||
blr
|
||||
|
||||
prim_strlen:
|
||||
mr %r5,%r3
|
||||
prim_strlen_loop:
|
||||
lbz %r4,0(%r3)
|
||||
cmpi 0,0,%r4,0
|
||||
beq prim_strlen_done
|
||||
addi %r3,%r3,1
|
||||
b prim_strlen_loop
|
||||
|
||||
prim_strlen_done:
|
||||
sub %r3,%r3,%r5
|
||||
blr
|
||||
|
||||
copy_bits:
|
||||
cmp 0,0,%r3,%r4
|
||||
beqlr
|
||||
lwz %r6,0(%r3)
|
||||
stw %r6,0(%r5)
|
||||
addi %r3,%r3,4
|
||||
addi %r5,%r5,4
|
||||
b copy_bits
|
||||
|
||||
ofw_print_string_hook:
|
||||
bl ofw_print_number
|
||||
bl ofw_exit
|
||||
|
||||
ofw_print_string:
|
||||
/* Reserve some stack space */
|
||||
subi %r1,%r1,32
|
||||
|
||||
/* Save args */
|
||||
stw %r3,0(%r1)
|
||||
|
||||
/* Save the lr, a scratch register */
|
||||
stw %r8,8(%r1)
|
||||
mflr %r8
|
||||
stw %r8,12(%r1)
|
||||
|
||||
/* Load the package name */
|
||||
lis %r3,0xe00000@ha
|
||||
addi %r3,%r3,ofw_chosen_name - _start
|
||||
|
||||
/* Fire */
|
||||
bl ofw_finddevice
|
||||
|
||||
/* Load up for getprop */
|
||||
stw %r3,16(%r1)
|
||||
|
||||
lis %r4,0xe00000@ha
|
||||
addi %r4,%r4,ofw_stdout_name - _start
|
||||
|
||||
addi %r5,%r1,20
|
||||
|
||||
li %r6,4
|
||||
|
||||
bl ofw_getprop
|
||||
|
||||
/* Measure the string and remember the length */
|
||||
lwz %r3,0(%r1)
|
||||
bl prim_strlen
|
||||
mr %r5,%r3
|
||||
|
||||
lwz %r3,20(%r1)
|
||||
lwz %r4,0(%r1)
|
||||
|
||||
/* Write the string */
|
||||
bl ofw_write
|
||||
|
||||
/* Return */
|
||||
lwz %r8,12(%r1)
|
||||
mtlr %r8
|
||||
lwz %r8,8(%r1)
|
||||
|
||||
addi %r1,%r1,32
|
||||
blr
|
||||
|
||||
/* Print 8 hex digits representing a number in r3 */
|
||||
ofw_print_number:
|
||||
subi %r1,%r1,32
|
||||
stw %r8,0(%r1)
|
||||
mflr %r8
|
||||
stw %r8,4(%r1)
|
||||
stw %r9,8(%r1)
|
||||
|
||||
xor %r9,%r9,%r9
|
||||
stw %r9,12(%r1)
|
||||
|
||||
/* Set up and, devide, shift */
|
||||
mr %r8,%r3
|
||||
lis %r6,0xf0000000@ha
|
||||
lis %r7,0x10000000@ha
|
||||
li %r9,8
|
||||
|
||||
ofw_number_loop:
|
||||
nop
|
||||
cmpi 0,0,%r9,0
|
||||
beq ofw_number_return
|
||||
subi %r9,%r9,1
|
||||
|
||||
/* Body: isolate digit, divide, print */
|
||||
and %r5,%r6,%r8
|
||||
divwu %r4,%r5,%r7
|
||||
srwi %r6,%r6,4
|
||||
srwi %r7,%r7,4
|
||||
|
||||
nop
|
||||
|
||||
cmpi 0,0,%r4,10
|
||||
bge ofw_number_letter
|
||||
addi %r4,%r4,'0'
|
||||
b ofw_number_digit_out
|
||||
|
||||
ofw_number_letter:
|
||||
addi %r4,%r4,'A' - 10
|
||||
|
||||
ofw_number_digit_out:
|
||||
stb %r4,12(%r1)
|
||||
addi %r3,%r1,12
|
||||
|
||||
stw %r6,16(%r1)
|
||||
stw %r7,20(%r1)
|
||||
stw %r8,24(%r1)
|
||||
stw %r9,28(%r1)
|
||||
|
||||
bl ofw_print_string
|
||||
|
||||
lwz %r6,16(%r1)
|
||||
lwz %r7,20(%r1)
|
||||
lwz %r8,24(%r1)
|
||||
lwz %r9,28(%r1)
|
||||
|
||||
b ofw_number_loop
|
||||
|
||||
ofw_number_return:
|
||||
/* Return */
|
||||
lwz %r9,8(%r1)
|
||||
lwz %r8,4(%r1)
|
||||
mtlr %r8
|
||||
lwz %r8,0(%r1)
|
||||
addi %r1,%r1,32
|
||||
blr
|
||||
|
||||
ofw_print_eol:
|
||||
subi %r1,%r1,16
|
||||
stw %r8,0(%r1)
|
||||
mflr %r8
|
||||
stw %r8,4(%r1)
|
||||
li %r4,0x0d0a
|
||||
sth %r4,8(%r1)
|
||||
xor %r4,%r4,%r4
|
||||
sth %r4,10(%r1)
|
||||
addi %r3,%r1,8
|
||||
bl ofw_print_string
|
||||
lwz %r8,4(%r1)
|
||||
mtlr %r8
|
||||
lwz %r8,0(%r1)
|
||||
addi %r1,%r1,16
|
||||
blr
|
||||
|
||||
ofw_print_nothing:
|
||||
subi %r1,%r1,16
|
||||
stw %r8,0(%r1)
|
||||
mflr %r8
|
||||
stw %r8,4(%r1)
|
||||
li %r4,0
|
||||
sth %r4,8(%r1)
|
||||
xor %r4,%r4,%r4
|
||||
sth %r4,10(%r1)
|
||||
addi %r3,%r1,8
|
||||
bl ofw_print_string
|
||||
lwz %r8,4(%r1)
|
||||
mtlr %r8
|
||||
lwz %r8,0(%r1)
|
||||
addi %r1,%r1,16
|
||||
blr
|
||||
|
||||
ofw_print_space:
|
||||
subi %r1,%r1,16
|
||||
stw %r8,0(%r1)
|
||||
mflr %r8
|
||||
stw %r8,4(%r1)
|
||||
li %r4,0x2000
|
||||
sth %r4,8(%r1)
|
||||
xor %r4,%r4,%r4
|
||||
sth %r4,10(%r1)
|
||||
addi %r3,%r1,8
|
||||
bl ofw_print_string
|
||||
lwz %r8,4(%r1)
|
||||
mtlr %r8
|
||||
lwz %r8,0(%r1)
|
||||
addi %r1,%r1,16
|
||||
blr
|
||||
|
||||
ofw_print_regs:
|
||||
/* Construct ofw exit call */
|
||||
subi %r1,%r1,0xa0
|
||||
|
||||
stw %r0,0(%r1)
|
||||
stw %r1,4(%r1)
|
||||
stw %r2,8(%r1)
|
||||
stw %r3,12(%r1)
|
||||
|
||||
stw %r4,16(%r1)
|
||||
stw %r5,20(%r1)
|
||||
stw %r6,24(%r1)
|
||||
stw %r7,28(%r1)
|
||||
|
||||
stw %r8,32(%r1)
|
||||
stw %r9,36(%r1)
|
||||
stw %r10,40(%r1)
|
||||
stw %r11,44(%r1)
|
||||
|
||||
stw %r12,48(%r1)
|
||||
stw %r13,52(%r1)
|
||||
stw %r14,56(%r1)
|
||||
stw %r15,60(%r1)
|
||||
|
||||
stw %r16,64(%r1)
|
||||
stw %r17,68(%r1)
|
||||
stw %r18,72(%r1)
|
||||
stw %r19,76(%r1)
|
||||
|
||||
stw %r20,80(%r1)
|
||||
stw %r21,84(%r1)
|
||||
stw %r22,88(%r1)
|
||||
stw %r23,92(%r1)
|
||||
|
||||
stw %r24,96(%r1)
|
||||
stw %r25,100(%r1)
|
||||
stw %r26,104(%r1)
|
||||
stw %r27,108(%r1)
|
||||
|
||||
stw %r28,112(%r1)
|
||||
stw %r29,116(%r1)
|
||||
stw %r30,120(%r1)
|
||||
stw %r31,124(%r1)
|
||||
|
||||
mflr %r0
|
||||
stw %r0,128(%r1)
|
||||
mfcr %r0
|
||||
stw %r0,132(%r1)
|
||||
mfctr %r0
|
||||
stw %r0,136(%r1)
|
||||
mfmsr %r0
|
||||
stw %r0,140(%r1)
|
||||
|
||||
/* Count at zero */
|
||||
xor %r0,%r0,%r0
|
||||
stw %r0,144(%r1)
|
||||
mr %r3,%r1
|
||||
stw %r3,148(%r1)
|
||||
|
||||
/* Body, print the regname, then the register */
|
||||
ofw_register_loop:
|
||||
lwz %r3,144(%r1)
|
||||
cmpi 0,0,%r3,32
|
||||
beq ofw_register_special
|
||||
lis %r3,0xe00000@ha
|
||||
addi %r3,%r3,freeldr_reg_init - _start
|
||||
bl ofw_print_string
|
||||
lwz %r3,144(%r1)
|
||||
bl ofw_print_number
|
||||
bl ofw_print_space
|
||||
lwz %r3,144(%r1)
|
||||
mulli %r3,%r3,4
|
||||
add %r3,%r1,%r3
|
||||
lwz %r3,0(%r3)
|
||||
stw %r3,152(%r1)
|
||||
bl ofw_print_number
|
||||
lwz %r3,144(%r1)
|
||||
addi %r3,%r3,1
|
||||
stw %r3,144(%r1)
|
||||
b done_dump
|
||||
|
||||
dump_optional:
|
||||
bl ofw_print_space
|
||||
bl ofw_print_space
|
||||
lwz %r3,152(%r1)
|
||||
lwz %r3,0(%r3)
|
||||
bl ofw_print_number
|
||||
bl ofw_print_space
|
||||
lwz %r3,152(%r1)
|
||||
lwz %r3,4(%r3)
|
||||
bl ofw_print_number
|
||||
bl ofw_print_space
|
||||
lwz %r3,152(%r1)
|
||||
lwz %r3,8(%r3)
|
||||
bl ofw_print_number
|
||||
bl ofw_print_space
|
||||
lwz %r3,152(%r1)
|
||||
lwz %r3,12(%r3)
|
||||
bl ofw_print_number
|
||||
bl ofw_print_space
|
||||
done_dump:
|
||||
bl ofw_print_eol
|
||||
b ofw_register_loop
|
||||
|
||||
ofw_register_special:
|
||||
/* LR */
|
||||
lis %r3,0xe00000@ha
|
||||
addi %r3,%r3,freeldr_reg_lr - _start
|
||||
bl ofw_print_string
|
||||
bl ofw_print_space
|
||||
lwz %r3,128(%r1)
|
||||
bl ofw_print_number
|
||||
bl ofw_print_eol
|
||||
|
||||
/* CR */
|
||||
lis %r3,0xe00000@ha
|
||||
addi %r3,%r3,freeldr_reg_cr - _start
|
||||
bl ofw_print_string
|
||||
bl ofw_print_space
|
||||
lwz %r3,132(%r1)
|
||||
bl ofw_print_number
|
||||
bl ofw_print_eol
|
||||
|
||||
/* CTR */
|
||||
lis %r3,0xe00000@ha
|
||||
addi %r3,%r3,freeldr_reg_ctr - _start
|
||||
bl ofw_print_string
|
||||
bl ofw_print_space
|
||||
lwz %r3,136(%r1)
|
||||
bl ofw_print_number
|
||||
bl ofw_print_eol
|
||||
|
||||
/* MSR */
|
||||
lis %r3,0xe00000@ha
|
||||
addi %r3,%r3,freeldr_reg_msr - _start
|
||||
bl ofw_print_string
|
||||
bl ofw_print_space
|
||||
lwz %r3,140(%r1)
|
||||
bl ofw_print_number
|
||||
bl ofw_print_eol
|
||||
|
||||
/* Return */
|
||||
lwz %r0,128(%r1)
|
||||
mtlr %r0
|
||||
|
||||
lwz %r0,0(%r1)
|
||||
lwz %r2,8(%r1)
|
||||
lwz %r3,12(%r1)
|
||||
|
||||
lwz %r4,16(%r1)
|
||||
lwz %r5,20(%r1)
|
||||
lwz %r6,24(%r1)
|
||||
lwz %r7,28(%r1)
|
||||
|
||||
addi %r1,%r1,0xa0
|
||||
|
||||
blr
|
||||
|
||||
ofw_finddevice_hook:
|
||||
subi %r1,%r1,32
|
||||
stw %r3,0(%r1)
|
||||
mflr %r3
|
||||
stw %r3,4(%r1)
|
||||
lwz %r3,0(%r1)
|
||||
bl ofw_finddevice
|
||||
stw %r3,0(%r1)
|
||||
lwz %r3,4(%r1)
|
||||
mtlr %r3
|
||||
lwz %r3,0(%r1)
|
||||
addi %r1,%r1,32
|
||||
blr
|
||||
|
||||
ofw_finddevice:
|
||||
/* Reserve stack space ...
|
||||
* 20 bytes for the ofw call,
|
||||
* r8, r9, and lr */
|
||||
subi %r1,%r1,32
|
||||
|
||||
/* Store r8, r9, lr */
|
||||
stw %r8,20(%r1)
|
||||
stw %r9,24(%r1)
|
||||
mflr %r8
|
||||
stw %r8,28(%r1)
|
||||
|
||||
/* Get finddevice name */
|
||||
lis %r8,0xe00000@ha
|
||||
addi %r9,%r8,ofw_finddevice_name - _start
|
||||
stw %r9,0(%r1)
|
||||
|
||||
/* 1 Argument and 1 return */
|
||||
li %r9,1
|
||||
stw %r9,4(%r1)
|
||||
stw %r9,8(%r1)
|
||||
|
||||
stw %r3,12(%r1)
|
||||
|
||||
/* Load up the call address */
|
||||
lwz %r9,ofw_call_addr - _start(%r8)
|
||||
mtlr %r9
|
||||
|
||||
/* Set argument */
|
||||
mr %r3,%r1
|
||||
|
||||
/* Fire */
|
||||
blrl
|
||||
|
||||
lwz %r3,16(%r1)
|
||||
|
||||
/* Restore registers */
|
||||
lwz %r8,28(%r1)
|
||||
mtlr %r8
|
||||
lwz %r9,24(%r1)
|
||||
lwz %r8,20(%r1)
|
||||
|
||||
addi %r1,%r1,32
|
||||
|
||||
/* Return */
|
||||
blr
|
||||
|
||||
ofw_getprop_hook:
|
||||
/* Reserve stack space:
|
||||
* 32 bytes for the ofw call
|
||||
* 12 bytes for r8, r9, lr
|
||||
*/
|
||||
/* Reserve stack space ...
|
||||
* 20 bytes for the ofw call,
|
||||
* r8, r9, and lr */
|
||||
subi %r1,%r1,48
|
||||
|
||||
/* Store r8, r9, lr */
|
||||
stw %r8,32(%r1)
|
||||
stw %r9,36(%r1)
|
||||
mflr %r8
|
||||
stw %r8,40(%r1)
|
||||
|
||||
/* Get getprop name */
|
||||
lis %r8,0xe00000@ha
|
||||
addi %r9,%r8,ofw_getprop_name - _start
|
||||
stw %r9,0(%r1)
|
||||
|
||||
/* 4 Argument and 1 return */
|
||||
li %r9,4
|
||||
stw %r9,4(%r1)
|
||||
li %r9,1
|
||||
stw %r9,8(%r1)
|
||||
|
||||
stw %r3,12(%r1) /* Package */
|
||||
stw %r4,16(%r1) /* Property */
|
||||
stw %r5,20(%r1) /* Return buffer */
|
||||
stw %r6,24(%r1) /* Buffer size */
|
||||
|
||||
/* Load up the call address */
|
||||
lwz %r9,ofw_call_addr - _start(%r8)
|
||||
mtlr %r9
|
||||
|
||||
/* Set argument */
|
||||
mr %r3,%r1
|
||||
|
||||
/* Fire */
|
||||
blrl
|
||||
|
||||
/* Workaround to a wierd crash ... not sure what causes it.
|
||||
* XXX investigate me */
|
||||
bl ofw_print_nothing
|
||||
|
||||
/* Return */
|
||||
lwz %r3,28(%r1)
|
||||
|
||||
/* Restore registers */
|
||||
lwz %r8,40(%r1)
|
||||
mtlr %r8
|
||||
lwz %r9,36(%r1)
|
||||
lwz %r8,32(%r1)
|
||||
|
||||
addi %r1,%r1,48
|
||||
|
||||
/* Return */
|
||||
blr
|
||||
|
||||
ofw_getprop:
|
||||
/* Reserve stack space:
|
||||
* 32 bytes for the ofw call
|
||||
* 12 bytes for r8, r9, lr
|
||||
*/
|
||||
/* Reserve stack space ...
|
||||
* 20 bytes for the ofw call,
|
||||
* r8, r9, and lr */
|
||||
subi %r1,%r1,48
|
||||
|
||||
/* Store r8, r9, lr */
|
||||
stw %r8,32(%r1)
|
||||
stw %r9,36(%r1)
|
||||
mflr %r8
|
||||
stw %r8,40(%r1)
|
||||
|
||||
/* Get getprop name */
|
||||
lis %r8,0xe00000@ha
|
||||
addi %r9,%r8,ofw_getprop_name - _start
|
||||
stw %r9,0(%r1)
|
||||
|
||||
/* 4 Argument and 1 return */
|
||||
li %r9,4
|
||||
stw %r9,4(%r1)
|
||||
li %r9,1
|
||||
stw %r9,8(%r1)
|
||||
|
||||
stw %r3,12(%r1) /* Package */
|
||||
stw %r4,16(%r1) /* Property */
|
||||
stw %r5,20(%r1) /* Return buffer */
|
||||
stw %r6,24(%r1) /* Buffer size */
|
||||
|
||||
/* Load up the call address */
|
||||
lwz %r9,ofw_call_addr - _start(%r8)
|
||||
mtlr %r9
|
||||
|
||||
/* Set argument */
|
||||
mr %r3,%r1
|
||||
|
||||
/* Fire */
|
||||
blrl
|
||||
|
||||
/* Return */
|
||||
lwz %r3,28(%r1)
|
||||
|
||||
/* Restore registers */
|
||||
lwz %r8,40(%r1)
|
||||
|
||||
mtlr %r8
|
||||
lwz %r9,36(%r1)
|
||||
lwz %r8,32(%r1)
|
||||
|
||||
addi %r1,%r1,48
|
||||
|
||||
/* Return */
|
||||
blr
|
||||
|
||||
ofw_write:
|
||||
/* Reserve stack space:
|
||||
* 28 bytes for the ofw call
|
||||
* 12 bytes for r8, r9, lr
|
||||
*/
|
||||
/* Reserve stack space ...
|
||||
* 20 bytes for the ofw call,
|
||||
* r8, r9, and lr */
|
||||
subi %r1,%r1,48
|
||||
|
||||
nop
|
||||
|
||||
/* Store r8, r9, lr */
|
||||
stw %r8,28(%r1)
|
||||
stw %r9,32(%r1)
|
||||
mflr %r8
|
||||
stw %r8,36(%r1)
|
||||
|
||||
/* Get write name */
|
||||
lis %r8,0xe00000@ha
|
||||
addi %r9,%r8,ofw_write_name - _start
|
||||
stw %r9,0(%r1)
|
||||
|
||||
/* 3 Arguments and 1 return */
|
||||
li %r9,3
|
||||
stw %r9,4(%r1)
|
||||
li %r9,1
|
||||
stw %r9,8(%r1)
|
||||
|
||||
stw %r3,12(%r1)
|
||||
stw %r4,16(%r1)
|
||||
stw %r5,20(%r1)
|
||||
|
||||
/* Load up the call address */
|
||||
lwz %r9,ofw_call_addr - _start(%r8)
|
||||
mtlr %r9
|
||||
|
||||
/* Set argument */
|
||||
mr %r3,%r1
|
||||
|
||||
/* Fire */
|
||||
blrl
|
||||
|
||||
/* Return */
|
||||
lwz %r3,24(%r1)
|
||||
|
||||
/* Restore registers */
|
||||
lwz %r8,36(%r1)
|
||||
mtlr %r8
|
||||
lwz %r9,32(%r1)
|
||||
lwz %r8,28(%r1)
|
||||
|
||||
addi %r1,%r1,48
|
||||
|
||||
/* Return */
|
||||
blr
|
||||
|
||||
ofw_read:
|
||||
/* Reserve stack space:
|
||||
* 28 bytes for the ofw call
|
||||
* 12 bytes for r8, r9, lr
|
||||
*/
|
||||
/* Reserve stack space ...
|
||||
* 20 bytes for the ofw call,
|
||||
* r8, r9, and lr */
|
||||
subi %r1,%r1,48
|
||||
|
||||
nop
|
||||
|
||||
/* Store r8, r9, lr */
|
||||
stw %r8,28(%r1)
|
||||
stw %r9,32(%r1)
|
||||
mflr %r8
|
||||
stw %r8,36(%r1)
|
||||
|
||||
/* Get read name */
|
||||
lis %r8,0xe00000@ha
|
||||
addi %r9,%r8,ofw_read_name - _start
|
||||
stw %r9,0(%r1)
|
||||
|
||||
/* 3 Arguments and 1 return */
|
||||
li %r9,3
|
||||
stw %r9,4(%r1)
|
||||
li %r9,1
|
||||
stw %r9,8(%r1)
|
||||
|
||||
stw %r3,12(%r1)
|
||||
stw %r4,16(%r1)
|
||||
stw %r5,20(%r1)
|
||||
|
||||
/* Load up the call address */
|
||||
lwz %r9,ofw_call_addr - _start(%r8)
|
||||
mtlr %r9
|
||||
|
||||
/* Set argument */
|
||||
mr %r3,%r1
|
||||
|
||||
/* Fire */
|
||||
blrl
|
||||
|
||||
/* Return */
|
||||
lwz %r3,24(%r1)
|
||||
|
||||
/* Restore registers */
|
||||
lwz %r8,36(%r1)
|
||||
mtlr %r8
|
||||
lwz %r9,32(%r1)
|
||||
lwz %r8,28(%r1)
|
||||
|
||||
addi %r1,%r1,48
|
||||
|
||||
/* Return */
|
||||
blr
|
||||
|
||||
ofw_exit:
|
||||
lis %r3,0xe00000@ha
|
||||
addi %r3,%r3,freeldr_halt - _start
|
||||
|
||||
bl ofw_print_string
|
||||
/*
|
||||
ofw_exit_loop:
|
||||
b ofw_exit_loop
|
||||
*/
|
||||
/* Load the exit name */
|
||||
lis %r8,0xe00000@ha
|
||||
addi %r9,%r8,ofw_exit_name - _start
|
||||
stw %r9,0(%r1)
|
||||
|
||||
/* Zero args, zero returns */
|
||||
xor %r9,%r9,%r9
|
||||
stw %r9,4(%r1)
|
||||
stw %r9,8(%r1)
|
||||
|
||||
/* Load up the call address */
|
||||
lwz %r9,ofw_call_addr - _start(%r8)
|
||||
mtlr %r9
|
||||
|
||||
mr %r3,%r1
|
||||
|
||||
/* Fire */
|
||||
blrl
|
||||
/* No return from exit */
|
||||
|
||||
.org 0x1000
|
||||
freeldr_banner:
|
||||
.ascii "ReactOS OpenFirmware Boot Program\r\n\0"
|
||||
|
||||
freeldr_halt:
|
||||
.ascii "ReactOS OpenFirmware Boot Program Halting\r\n\0"
|
||||
|
||||
freeldr_reg_init:
|
||||
.ascii "r\0"
|
||||
|
||||
freeldr_reg_lr:
|
||||
.ascii "lr \0"
|
||||
freeldr_reg_cr:
|
||||
.ascii "cr \0"
|
||||
freeldr_reg_ctr:
|
||||
.ascii "ctr\0"
|
||||
freeldr_reg_msr:
|
||||
.ascii "msr\0"
|
||||
|
||||
ofw_call_addr:
|
||||
.long 0
|
||||
|
||||
ofw_memory_size:
|
||||
.long 0
|
||||
.long 0
|
||||
.long 0
|
||||
.long 0
|
||||
|
||||
ofw_finddevice_name:
|
||||
.ascii "finddevice\0"
|
||||
|
||||
ofw_getprop_name:
|
||||
.ascii "getprop\0"
|
||||
|
||||
ofw_write_name:
|
||||
.ascii "write\0"
|
||||
|
||||
ofw_read_name:
|
||||
.ascii "read\0"
|
||||
|
||||
ofw_exit_name:
|
||||
.ascii "exit\0"
|
||||
|
||||
ofw_chosen_name:
|
||||
.ascii "/chosen\0"
|
||||
|
||||
ofw_stdout_name:
|
||||
.ascii "stdout\0"
|
||||
|
||||
ofw_memory_name:
|
||||
.ascii "/memory@0\0"
|
||||
|
||||
ofw_reg_name:
|
||||
.ascii "reg\0"
|
||||
|
||||
ofw_functions:
|
||||
.long ofw_finddevice_hook
|
||||
.long ofw_getprop_hook
|
||||
.long ofw_write
|
||||
.long ofw_read
|
||||
.long ofw_exit
|
||||
.long ofw_print_regs
|
||||
.long ofw_print_string
|
||||
.long ofw_print_number
|
||||
|
||||
.org 0x2000
|
||||
stack:
|
||||
.space 0x4000
|
@@ -47,10 +47,10 @@ EXTERN(RealEntryPoint)
|
||||
.code32
|
||||
|
||||
/* Store the boot drive */
|
||||
movb %dl,(_BootDrive)
|
||||
movb %dl,(_i386BootDrive)
|
||||
|
||||
/* Store the boot partition */
|
||||
movb %dh,(_BootPartition)
|
||||
movb %dh,(_i386BootPartition)
|
||||
|
||||
/* GO! */
|
||||
xorl %eax,%eax
|
||||
@@ -275,9 +275,11 @@ EXTERN(_DisableA20)
|
||||
* other boot loaders like Grub
|
||||
*/
|
||||
|
||||
#define MB_INFO_SIZE 90
|
||||
#define MB_INFO_FLAGS_OFFSET 0
|
||||
#define MB_INFO_BOOT_DEVICE_OFFSET 12
|
||||
#define MB_INFO_COMMAND_LINE_OFFSET 16
|
||||
#define CMDLINE_SIZE 256
|
||||
|
||||
/*
|
||||
* We want to execute at 0x8000 (to be compatible with bootsector
|
||||
@@ -285,7 +287,6 @@ EXTERN(_DisableA20)
|
||||
* above 1MB. So we let Grub load us there and then relocate
|
||||
* ourself to 0x8000
|
||||
*/
|
||||
#define CMDLINE_BASE 0x7000
|
||||
#define FREELDR_BASE 0x8000
|
||||
#define INITIAL_BASE 0x200000
|
||||
|
||||
@@ -328,6 +329,31 @@ mb1:
|
||||
movw %dx,%ds
|
||||
movw %dx,%es
|
||||
|
||||
/* Check for valid multiboot signature */
|
||||
cmpl $MULTIBOOT_BOOTLOADER_MAGIC,%eax
|
||||
jne mbfail
|
||||
|
||||
/* Store multiboot info in a safe place */
|
||||
movl %ebx,%esi
|
||||
movl $(mb_info + INITIAL_BASE - FREELDR_BASE),%edi
|
||||
movl $MB_INFO_SIZE,%ecx
|
||||
rep movsb
|
||||
|
||||
/* Save commandline */
|
||||
movl MB_INFO_FLAGS_OFFSET(%ebx),%edx
|
||||
testl $MB_INFO_FLAG_COMMAND_LINE,MB_INFO_FLAGS_OFFSET(%ebx)
|
||||
jz mb3
|
||||
movl MB_INFO_COMMAND_LINE_OFFSET(%ebx),%esi
|
||||
movl $(cmdline + INITIAL_BASE - FREELDR_BASE),%edi
|
||||
movl $CMDLINE_SIZE,%ecx
|
||||
mb2: lodsb
|
||||
stosb
|
||||
testb %al,%al
|
||||
jz mb3
|
||||
dec %ecx
|
||||
jnz mb2
|
||||
mb3:
|
||||
|
||||
/* Copy to low mem */
|
||||
movl $INITIAL_BASE,%esi
|
||||
movl $FREELDR_BASE,%edi
|
||||
@@ -342,8 +368,8 @@ mb1:
|
||||
|
||||
/* Clear prefetch queue & correct CS,
|
||||
* jump to low mem */
|
||||
ljmp $PMODE_CS, $mb2
|
||||
mb2:
|
||||
ljmp $PMODE_CS, $mb4
|
||||
mb4:
|
||||
/* Reload segment selectors */
|
||||
movw $PMODE_DS,%dx
|
||||
movw %dx,%ds
|
||||
@@ -353,39 +379,28 @@ mb2:
|
||||
movw %dx,%ss
|
||||
movl $STACK32ADDR,%esp
|
||||
|
||||
/* Check for valid multiboot signature */
|
||||
cmpl $MULTIBOOT_BOOTLOADER_MAGIC,%eax
|
||||
jne mbfail
|
||||
|
||||
movl $mb_info,%ebx
|
||||
/* See if the boot device was passed in */
|
||||
movl MB_INFO_FLAGS_OFFSET(%ebx),%edx
|
||||
testl $MB_INFO_FLAG_BOOT_DEVICE,%edx
|
||||
jz mb3
|
||||
jz mb5
|
||||
/* Retrieve boot device info */
|
||||
movl MB_INFO_BOOT_DEVICE_OFFSET(%ebx),%eax
|
||||
shrl $16,%eax
|
||||
incb %al
|
||||
movb %al,_BootPartition
|
||||
movb %ah,_BootDrive
|
||||
jmp mb4
|
||||
mb3: /* No boot device known, assume first partition of first harddisk */
|
||||
movb $0x80,_BootDrive
|
||||
movb $1,_BootPartition
|
||||
mb4:
|
||||
|
||||
/* Check for a command line */
|
||||
xorl %eax,%eax
|
||||
testl $MB_INFO_FLAG_COMMAND_LINE,%edx
|
||||
jz mb6
|
||||
/* Copy command line to low mem*/
|
||||
movl MB_INFO_COMMAND_LINE_OFFSET(%ebx),%esi
|
||||
movl $CMDLINE_BASE,%edi
|
||||
mb5: lodsb
|
||||
stosb
|
||||
testb %al,%al
|
||||
jnz mb5
|
||||
movl $CMDLINE_BASE,%eax
|
||||
movb %al,_i386BootPartition
|
||||
movb %ah,_i386BootDrive
|
||||
jmp mb6
|
||||
mb5: /* No boot device known, assume first partition of first harddisk */
|
||||
movb $0x80,_i386BootDrive
|
||||
movb $1,_i386BootPartition
|
||||
mb6:
|
||||
/* Check for command line */
|
||||
mov $cmdline,%eax
|
||||
testl $MB_INFO_FLAG_COMMAND_LINE,MB_INFO_FLAGS_OFFSET(%ebx)
|
||||
jnz mb7
|
||||
xorl %eax,%eax
|
||||
mb7:
|
||||
|
||||
/* GO! */
|
||||
pushl %eax
|
||||
@@ -462,8 +477,15 @@ rmode_idtptr:
|
||||
.word 0x3ff /* Limit */
|
||||
.long 0 /* Base Address */
|
||||
|
||||
EXTERN(_BootDrive)
|
||||
EXTERN(_i386BootDrive)
|
||||
.long 0
|
||||
|
||||
EXTERN(_BootPartition)
|
||||
EXTERN(_i386BootPartition)
|
||||
.long 0
|
||||
|
||||
.bss
|
||||
mb_info:
|
||||
.fill MB_INFO_SIZE, 1, 0
|
||||
|
||||
cmdline:
|
||||
.fill CMDLINE_SIZE, 1, 0
|
||||
|
@@ -27,7 +27,7 @@
|
||||
#include "rtl.h"
|
||||
|
||||
VOID
|
||||
MachInit(VOID)
|
||||
MachInit(char *CmdLine)
|
||||
{
|
||||
ULONG PciId;
|
||||
|
||||
@@ -39,11 +39,11 @@ MachInit(VOID)
|
||||
PciId = READ_PORT_ULONG((ULONG*) 0xcfc);
|
||||
if (0x02a510de == PciId)
|
||||
{
|
||||
XboxMachInit();
|
||||
XboxMachInit(CmdLine);
|
||||
}
|
||||
else
|
||||
{
|
||||
PcMachInit();
|
||||
PcMachInit(CmdLine);
|
||||
}
|
||||
|
||||
HalpCalibrateStallExecution();
|
||||
|
@@ -31,7 +31,7 @@ EXTERN(_ChainLoadBiosBootSectorCode)
|
||||
.code16
|
||||
|
||||
/* Set the boot drive */
|
||||
movb (_BootDrive),%dl
|
||||
movb (_i386BootDrive),%dl
|
||||
|
||||
/* Load segment registers */
|
||||
cli
|
||||
|
40
reactos/boot/freeldr/freeldr/arch/i386/i386.h
Normal file
40
reactos/boot/freeldr/freeldr/arch/i386/i386.h
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* FreeLoader
|
||||
*
|
||||
* Copyright (C) 2003 Eric Kohl
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __I386_I386_H_
|
||||
#define __I386_I386_H_
|
||||
|
||||
|
||||
extern ULONG i386BootDrive;
|
||||
extern ULONG i386BootPartition;
|
||||
|
||||
extern BOOL i386DiskGetBootVolume(PULONG DriveNumber, PULONGLONG StartSector,
|
||||
PULONGLONG SectorCount, int *FsType);
|
||||
extern BOOL i386DiskGetSystemVolume(char *SystemPath, char *RemainingPath,
|
||||
PULONG Device, PULONG DriveNumber,
|
||||
PULONGLONG StartSector,
|
||||
PULONGLONG SectorCount, int *FsType);
|
||||
extern BOOL i386DiskGetBootPath(char *BootPath, unsigned Size);
|
||||
extern VOID i386DiskGetBootDevice(PULONG BootDevice);
|
||||
extern BOOL i386DiskBootingFromFloppy(VOID);
|
||||
|
||||
#endif /* __I386_I386_H_ */
|
||||
|
||||
/* EOF */
|
@@ -19,6 +19,8 @@
|
||||
|
||||
#include "freeldr.h"
|
||||
#include "debug.h"
|
||||
#include "i386.h"
|
||||
#include "fsrec.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// FUNCTIONS
|
||||
@@ -166,4 +168,244 @@ BOOL DiskGetExtendedDriveParameters(ULONG DriveNumber, PVOID Buffer, USHORT Buff
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif // defined __i386__
|
||||
BOOL i386DiskGetBootVolume(PULONG DriveNumber, PULONGLONG StartSector, PULONGLONG SectorCount, int *FsType)
|
||||
{
|
||||
PARTITION_TABLE_ENTRY PartitionTableEntry;
|
||||
UCHAR VolumeType;
|
||||
|
||||
DbgPrint((DPRINT_FILESYSTEM, "FsOpenVolume() DriveNumber: 0x%x PartitionNumber: 0x%x\n", i386BootDrive, i386BootPartition));
|
||||
|
||||
// Check and see if it is a floppy drive
|
||||
// If so then just assume FAT12 file system type
|
||||
if (DiskIsDriveRemovable(i386BootDrive))
|
||||
{
|
||||
DbgPrint((DPRINT_FILESYSTEM, "Drive is a floppy diskette drive. Assuming FAT12 file system.\n"));
|
||||
|
||||
*DriveNumber = i386BootDrive;
|
||||
*StartSector = 0;
|
||||
*SectorCount = 2 * 80 * 18; /* FIXME hardcoded for 1.44 Mb */
|
||||
*FsType = FS_FAT;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Check for ISO9660 file system type
|
||||
if (i386BootDrive >= 0x80 && FsRecIsIso9660(i386BootDrive))
|
||||
{
|
||||
DbgPrint((DPRINT_FILESYSTEM, "Drive is a cdrom drive. Assuming ISO-9660 file system.\n"));
|
||||
|
||||
*DriveNumber = i386BootDrive;
|
||||
*StartSector = 0;
|
||||
*SectorCount = 0;
|
||||
*FsType = FS_ISO9660;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Get the requested partition entry
|
||||
if (i386BootPartition == 0)
|
||||
{
|
||||
// Partition requested was zero which means the boot partition
|
||||
if (! DiskGetActivePartitionEntry(i386BootDrive, &PartitionTableEntry))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get requested partition
|
||||
if (! MachDiskGetPartitionEntry(i386BootDrive, i386BootPartition, &PartitionTableEntry))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// Check for valid partition
|
||||
if (PartitionTableEntry.SystemIndicator == PARTITION_ENTRY_UNUSED)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Try to recognize the file system
|
||||
if (!FsRecognizeVolume(i386BootDrive, PartitionTableEntry.SectorCountBeforePartition, &VolumeType))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
*DriveNumber = i386BootDrive;
|
||||
*StartSector = PartitionTableEntry.SectorCountBeforePartition;
|
||||
*SectorCount = PartitionTableEntry.PartitionSectorCount;
|
||||
|
||||
//switch (PartitionTableEntry.SystemIndicator)
|
||||
switch (VolumeType)
|
||||
{
|
||||
case PARTITION_FAT_12:
|
||||
case PARTITION_FAT_16:
|
||||
case PARTITION_HUGE:
|
||||
case PARTITION_XINT13:
|
||||
case PARTITION_FAT32:
|
||||
case PARTITION_FAT32_XINT13:
|
||||
*FsType = FS_FAT;
|
||||
return TRUE;
|
||||
case PARTITION_EXT2:
|
||||
*FsType = FS_EXT2;
|
||||
return TRUE;
|
||||
case PARTITION_NTFS:
|
||||
*FsType = FS_NTFS;
|
||||
return TRUE;
|
||||
default:
|
||||
*FsType = 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
VOID
|
||||
i386DiskGetBootDevice(PULONG BootDevice)
|
||||
{
|
||||
((char *)BootDevice)[0] = (char)i386BootDrive;
|
||||
((char *)BootDevice)[1] = (char)i386BootPartition;
|
||||
}
|
||||
|
||||
BOOL
|
||||
i386DiskBootingFromFloppy(VOID)
|
||||
{
|
||||
return i386BootDrive < 0x80;
|
||||
}
|
||||
|
||||
#define IsRecognizedPartition(P) \
|
||||
((P) == PARTITION_FAT_12 || \
|
||||
(P) == PARTITION_FAT_16 || \
|
||||
(P) == PARTITION_HUGE || \
|
||||
(P) == PARTITION_IFS || \
|
||||
(P) == PARTITION_EXT2 || \
|
||||
(P) == PARTITION_FAT32 || \
|
||||
(P) == PARTITION_FAT32_XINT13 || \
|
||||
(P) == PARTITION_XINT13)
|
||||
|
||||
BOOL i386DiskGetSystemVolume(char *SystemPath,
|
||||
char *RemainingPath,
|
||||
PULONG Device,
|
||||
PULONG DriveNumber,
|
||||
PULONGLONG StartSector,
|
||||
PULONGLONG SectorCount,
|
||||
int *FsType)
|
||||
{
|
||||
ULONG PartitionNumber;
|
||||
PARTITION_TABLE_ENTRY PartitionTableEntry;
|
||||
UCHAR VolumeType;
|
||||
CHAR BootPath[256];
|
||||
unsigned i, RosPartition;
|
||||
|
||||
/*
|
||||
* Verify system path
|
||||
*/
|
||||
if (!DissectArcPath(SystemPath, BootPath, DriveNumber, &PartitionNumber))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
if (NULL != RemainingPath)
|
||||
{
|
||||
strcpy(RemainingPath, BootPath);
|
||||
}
|
||||
|
||||
/* 0xff -> no partition table present, use whole device */
|
||||
if (0xff == PartitionNumber)
|
||||
{
|
||||
PartitionTableEntry.SectorCountBeforePartition = 0;
|
||||
i = 0xff;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* recalculate the boot partition for freeldr */
|
||||
i = 0;
|
||||
RosPartition = 0;
|
||||
while (1)
|
||||
{
|
||||
if (!MachDiskGetPartitionEntry(*DriveNumber, ++i, &PartitionTableEntry))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
if (IsRecognizedPartition(PartitionTableEntry.SystemIndicator))
|
||||
{
|
||||
if (++RosPartition == PartitionNumber)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Check for ISO9660 file system type */
|
||||
if (*DriveNumber >= 0x80 && FsRecIsIso9660(*DriveNumber))
|
||||
{
|
||||
DbgPrint((DPRINT_FILESYSTEM, "Drive is a cdrom drive. Assuming ISO-9660 file system.\n"));
|
||||
|
||||
if (NULL != Device)
|
||||
{
|
||||
((char *)Device)[0] = (char)(*DriveNumber);
|
||||
((char *)Device)[1] = (char)i;
|
||||
}
|
||||
*StartSector = 0;
|
||||
*SectorCount = 0;
|
||||
*FsType = FS_ISO9660;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (!FsRecognizeVolume(*DriveNumber, PartitionTableEntry.SectorCountBeforePartition, &VolumeType))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (NULL != Device)
|
||||
{
|
||||
((char *)Device)[0] = (char)(*DriveNumber);
|
||||
((char *)Device)[1] = (char)i;
|
||||
}
|
||||
*StartSector = PartitionTableEntry.SectorCountBeforePartition;
|
||||
*SectorCount = PartitionTableEntry.PartitionSectorCount;
|
||||
|
||||
switch (VolumeType)
|
||||
{
|
||||
case PARTITION_FAT_12:
|
||||
case PARTITION_FAT_16:
|
||||
case PARTITION_HUGE:
|
||||
case PARTITION_XINT13:
|
||||
case PARTITION_FAT32:
|
||||
case PARTITION_FAT32_XINT13:
|
||||
*FsType = FS_FAT;
|
||||
return TRUE;
|
||||
case PARTITION_EXT2:
|
||||
*FsType = FS_EXT2;
|
||||
return TRUE;
|
||||
case PARTITION_NTFS:
|
||||
*FsType = FS_NTFS;
|
||||
return TRUE;
|
||||
default:
|
||||
*FsType = 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL
|
||||
i386DiskGetBootPath(char *BootPath, unsigned Size)
|
||||
{
|
||||
static char Path[] = "multi(0)disk(0)";
|
||||
char Device[4];
|
||||
|
||||
itoa(i386BootDrive, Device, 10);
|
||||
if (Size <= sizeof(Path) + 6 + strlen(Device))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
strcpy(BootPath, Path);
|
||||
strcat(BootPath, MachDiskBootingFromFloppy() ? "fdisk" : "cdrom");
|
||||
strcat(strcat(strcat(BootPath, "("), Device), ")");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif /* defined __i386__ */
|
||||
|
||||
/* EOF */
|
||||
|
@@ -30,7 +30,7 @@ EXTERN(_BootNewLinuxKernel)
|
||||
.code16
|
||||
|
||||
/* Set the boot drive */
|
||||
movb (_BootDrive),%dl
|
||||
movb (_i386BootDrive),%dl
|
||||
|
||||
/* Load segment registers */
|
||||
cli
|
||||
@@ -66,7 +66,7 @@ EXTERN(_BootOldLinuxKernel)
|
||||
.code16
|
||||
|
||||
/* Set the boot drive */
|
||||
movb (_BootDrive),%dl
|
||||
movb (_i386BootDrive),%dl
|
||||
|
||||
/* Load segment registers */
|
||||
cli
|
||||
|
@@ -23,9 +23,10 @@
|
||||
#include "machine.h"
|
||||
#include "machpc.h"
|
||||
#include "rtl.h"
|
||||
#include "i386.h"
|
||||
|
||||
VOID
|
||||
PcMachInit(VOID)
|
||||
PcMachInit(char *CmdLine)
|
||||
{
|
||||
EnableA20();
|
||||
|
||||
@@ -48,6 +49,11 @@ PcMachInit(VOID)
|
||||
MachVtbl.VideoSync = PcVideoSync;
|
||||
MachVtbl.VideoPrepareForReactOS = PcVideoPrepareForReactOS;
|
||||
MachVtbl.GetMemoryMap = PcMemGetMemoryMap;
|
||||
MachVtbl.DiskGetBootVolume = i386DiskGetBootVolume;
|
||||
MachVtbl.DiskGetSystemVolume = i386DiskGetSystemVolume;
|
||||
MachVtbl.DiskGetBootPath = i386DiskGetBootPath;
|
||||
MachVtbl.DiskGetBootDevice = i386DiskGetBootDevice;
|
||||
MachVtbl.DiskBootingFromFloppy = i386DiskBootingFromFloppy;
|
||||
MachVtbl.DiskReadLogicalSectors = PcDiskReadLogicalSectors;
|
||||
MachVtbl.DiskGetPartitionEntry = PcDiskGetPartitionEntry;
|
||||
MachVtbl.DiskGetDriveGeometry = PcDiskGetDriveGeometry;
|
||||
|
@@ -26,7 +26,7 @@
|
||||
#include "mm.h"
|
||||
#endif
|
||||
|
||||
VOID PcMachInit(VOID);
|
||||
VOID PcMachInit(char *CmdLine);
|
||||
|
||||
VOID PcConsPutChar(int Ch);
|
||||
BOOL PcConsKbHit();
|
||||
|
@@ -21,9 +21,10 @@
|
||||
#include "mm.h"
|
||||
#include "machine.h"
|
||||
#include "machxbox.h"
|
||||
#include "i386.h"
|
||||
|
||||
VOID
|
||||
XboxMachInit(VOID)
|
||||
XboxMachInit(char *CmdLine)
|
||||
{
|
||||
/* Initialize our stuff */
|
||||
XboxMemInit();
|
||||
@@ -46,6 +47,11 @@ XboxMachInit(VOID)
|
||||
MachVtbl.VideoSync = XboxVideoSync;
|
||||
MachVtbl.VideoPrepareForReactOS = XboxVideoPrepareForReactOS;
|
||||
MachVtbl.GetMemoryMap = XboxMemGetMemoryMap;
|
||||
MachVtbl.DiskGetBootVolume = i386DiskGetBootVolume;
|
||||
MachVtbl.DiskGetSystemVolume = i386DiskGetSystemVolume;
|
||||
MachVtbl.DiskGetBootPath = i386DiskGetBootPath;
|
||||
MachVtbl.DiskGetBootDevice = i386DiskGetBootDevice;
|
||||
MachVtbl.DiskBootingFromFloppy = i386DiskBootingFromFloppy;
|
||||
MachVtbl.DiskReadLogicalSectors = XboxDiskReadLogicalSectors;
|
||||
MachVtbl.DiskGetPartitionEntry = XboxDiskGetPartitionEntry;
|
||||
MachVtbl.DiskGetDriveGeometry = XboxDiskGetDriveGeometry;
|
||||
|
@@ -26,7 +26,7 @@
|
||||
|
||||
UCHAR XboxFont8x16[256 * 16];
|
||||
|
||||
VOID XboxMachInit(VOID);
|
||||
VOID XboxMachInit(char *CmdLine);
|
||||
|
||||
VOID XboxConsPutChar(int Ch);
|
||||
BOOL XboxConsKbHit();
|
||||
|
3
reactos/boot/freeldr/freeldr/arch/powerpc/boot.s
Normal file
3
reactos/boot/freeldr/freeldr/arch/powerpc/boot.s
Normal file
@@ -0,0 +1,3 @@
|
||||
.extern PpcInit
|
||||
_start:
|
||||
b PpcInit
|
305
reactos/boot/freeldr/freeldr/arch/powerpc/mach.c
Normal file
305
reactos/boot/freeldr/freeldr/arch/powerpc/mach.c
Normal file
@@ -0,0 +1,305 @@
|
||||
/*
|
||||
* FreeLoader PowerPC Part
|
||||
* Copyright (C) 2005 Art Yerkes
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
#include "freeldr.h"
|
||||
#include "machine.h"
|
||||
#include "of.h"
|
||||
|
||||
extern void BootMain( char * );
|
||||
extern char *GetFreeLoaderVersionString();
|
||||
ULONG BootPartition = 0;
|
||||
ULONG BootDrive = 0;
|
||||
|
||||
of_proxy ofproxy;
|
||||
void *PageDirectoryStart, *PageDirectoryEnd;
|
||||
static int chosen_package, stdin_handle;
|
||||
BOOLEAN AcpiPresent = FALSE;
|
||||
char BootPath[0x100];
|
||||
|
||||
void le_swap( const void *start_addr_v,
|
||||
const void *end_addr_v,
|
||||
const void *target_addr_v ) {
|
||||
long *start_addr = (long *)ROUND_DOWN((long)start_addr_v,8),
|
||||
*end_addr = (long *)ROUND_UP((long)end_addr_v,8),
|
||||
*target_addr = (long *)ROUND_DOWN((long)target_addr_v,8);
|
||||
long tmp;
|
||||
while( start_addr <= end_addr ) {
|
||||
tmp = start_addr[0];
|
||||
target_addr[0] = REV(start_addr[1]);
|
||||
target_addr[1] = REV(tmp);
|
||||
start_addr += 2;
|
||||
target_addr += 2;
|
||||
}
|
||||
}
|
||||
|
||||
int ofw_finddevice( const char *name ) {
|
||||
int ret, len;
|
||||
|
||||
len = strlen(name);
|
||||
le_swap( name, name + len, name );
|
||||
ret = ofproxy( 0, (char *)name, NULL, NULL, NULL );
|
||||
le_swap( name, name + len, name );
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ofw_getprop( int package, const char *name, void *buffer, int buflen ) {
|
||||
int ret, len = strlen(name);
|
||||
le_swap( name, name + len, name );
|
||||
le_swap( buffer, buffer + buflen, buffer );
|
||||
ret = ofproxy
|
||||
( 4, (void *)package, (char *)name, buffer, (void *)buflen );
|
||||
le_swap( buffer, buffer + buflen, buffer );
|
||||
le_swap( name, name + len, name );
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ofw_write( int handle, const char *data, int len ) {
|
||||
int ret;
|
||||
le_swap( data, data + len, data );
|
||||
ret = ofproxy
|
||||
( 8, (void *)handle, (char *)data, (void *)len, NULL );
|
||||
le_swap( data, data + len, data );
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ofw_read( int handle, const char *data, int len ) {
|
||||
int ret;
|
||||
le_swap( data, data + len, data );
|
||||
ret = ofproxy
|
||||
( 12, (void *)handle, (char *)data, (void *)len, NULL );
|
||||
le_swap( data, data + len, data );
|
||||
return ret;
|
||||
}
|
||||
|
||||
void ofw_exit() {
|
||||
ofproxy( 16, NULL, NULL, NULL, NULL );
|
||||
}
|
||||
|
||||
void ofw_dumpregs() {
|
||||
ofproxy( 20, NULL, NULL, NULL, NULL );
|
||||
}
|
||||
|
||||
void ofw_print_string( const char *str ) {
|
||||
int len = strlen(str);
|
||||
le_swap( (char *)str, str + len, (char *)str );
|
||||
ofproxy( 24, (void *)str, NULL, NULL, NULL );
|
||||
le_swap( (char *)str, str + len, (char *)str );
|
||||
}
|
||||
|
||||
void ofw_print_number( int num ) {
|
||||
ofproxy( 28, (void *)num, NULL, NULL, NULL );
|
||||
}
|
||||
|
||||
void PpcPutChar( int ch ) {
|
||||
char buf[3];
|
||||
if( ch == 0x0a ) { buf[0] = 0x0d; buf[1] = 0x0a; }
|
||||
else { buf[0] = ch; buf[1] = 0; }
|
||||
buf[2] = 0;
|
||||
ofw_print_string( buf );
|
||||
}
|
||||
|
||||
BOOL PpcConsKbHit() {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int PpcConsGetCh() {
|
||||
char buf;
|
||||
ofw_read( stdin_handle, &buf, 1 );
|
||||
return buf;
|
||||
}
|
||||
|
||||
void PpcVideoClearScreen( UCHAR Attr ) {
|
||||
ofw_print_string("ClearScreen\n");
|
||||
}
|
||||
|
||||
VIDEODISPLAYMODE PpcVideoSetDisplayMode( char *DisplayMode, BOOL Init ) {
|
||||
printf( "DisplayMode: %s %s\n", DisplayMode, Init ? "true" : "false" );
|
||||
return VideoGraphicsMode;
|
||||
}
|
||||
|
||||
/* FIXME: Query */
|
||||
VOID PpcVideoGetDisplaySize( PULONG Width, PULONG Height, PULONG Depth ) {
|
||||
ofw_print_string("GetDisplaySize\n");
|
||||
*Width = 640;
|
||||
*Height = 480;
|
||||
*Depth = 8;
|
||||
}
|
||||
|
||||
ULONG PpcVideoGetBufferSize() {
|
||||
ULONG Width, Height, Depth;
|
||||
ofw_print_string("PpcVideoGetBufferSize\n");
|
||||
PpcVideoGetDisplaySize( &Width, &Height, &Depth );
|
||||
return Width * Height * Depth / 8;
|
||||
}
|
||||
|
||||
VOID PpcVideoSetTextCursorPosition( ULONG X, ULONG Y ) {
|
||||
printf("SetTextCursorPosition(%d,%d)\n", X,Y);
|
||||
}
|
||||
|
||||
VOID PpcVideoHideShowTextCursor( BOOL Show ) {
|
||||
printf("HideShowTextCursor(%s)\n", Show ? "true" : "false");
|
||||
}
|
||||
|
||||
VOID PpcVideoPutChar( int Ch, UCHAR Attr, unsigned X, unsigned Y ) {
|
||||
printf( "\033[%d;%dH%c", Y, X, Ch );
|
||||
}
|
||||
|
||||
VOID PpcVideoCopyOffScreenBufferToVRAM( PVOID Buffer ) {
|
||||
printf( "CopyOffScreenBufferToVRAM(%x)\n", Buffer );
|
||||
}
|
||||
|
||||
BOOL PpcVideoIsPaletteFixed() {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
VOID PpcVideoSetPaletteColor( UCHAR Color,
|
||||
UCHAR Red, UCHAR Green, UCHAR Blue ) {
|
||||
printf( "SetPaletteColor(%x,%x,%x,%x)\n", Color, Red, Green, Blue );
|
||||
}
|
||||
|
||||
VOID PpcVideoGetPaletteColor( UCHAR Color,
|
||||
UCHAR *Red, UCHAR *Green, UCHAR *Blue ) {
|
||||
printf( "GetPaletteColor(%x)\n", Color);
|
||||
}
|
||||
|
||||
VOID PpcVideoSync() {
|
||||
printf( "Sync\n" );
|
||||
}
|
||||
|
||||
VOID PpcVideoPrepareForReactOS() {
|
||||
printf( "PrepareForReactOS\n");
|
||||
}
|
||||
/* XXX FIXME:
|
||||
* According to the linux people (this is backed up by my own experience),
|
||||
* the memory object in older ofw does not do getprop right.
|
||||
*
|
||||
* The "right" way is to probe the pci bridge. *sigh*
|
||||
*/
|
||||
ULONG PpcGetMemoryMap( PBIOS_MEMORY_MAP BiosMemoryMap,
|
||||
ULONG MaxMemoryMapSize ) {
|
||||
printf("GetMemoryMap(chosen=%x)\n", chosen_package);
|
||||
|
||||
BiosMemoryMap[0].Type = MEMTYPE_USABLE;
|
||||
BiosMemoryMap[0].BaseAddress = 0;
|
||||
BiosMemoryMap[0].Length = 32 * 1024 * 1024; /* Assume 32 meg for now */
|
||||
|
||||
printf( "Returning memory map (%dk total)\n",
|
||||
(int)BiosMemoryMap[0].Length / 1024 );
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
BOOL PpcDiskReadLogicalSectors( ULONG DriveNumber, ULONGLONG SectorNumber,
|
||||
ULONG SectorCount, PVOID Buffer ) {
|
||||
printf("DiskReadLogicalSectors\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL PpcDiskGetPartitionEntry( ULONG DriveNumber, ULONG PartitionNumber,
|
||||
PPARTITION_TABLE_ENTRY PartitionTableEntry ) {
|
||||
printf("GetPartitionEntry(%d,%d)\n", DriveNumber, PartitionNumber);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL PpcDiskGetDriveGeometry( ULONG DriveNumber, PGEOMETRY DriveGeometry ) {
|
||||
printf("GetGeometry(%d)\n", DriveNumber);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
ULONG PpcDiskGetCacheableBlockCount( ULONG DriveNumber ) {
|
||||
printf("GetCacheableBlockCount\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
VOID PpcRTCGetCurrentDateTime( PULONG Hear, PULONG Month, PULONG Day,
|
||||
PULONG Hour, PULONG Minute, PULONG Second ) {
|
||||
printf("RTCGeturrentDateTime\n");
|
||||
}
|
||||
|
||||
VOID PpcHwDetect() {
|
||||
}
|
||||
|
||||
void PpcInit( of_proxy the_ofproxy ) {
|
||||
ofproxy = the_ofproxy;
|
||||
chosen_package = ofw_finddevice( "/chosen" );
|
||||
|
||||
ofw_getprop( chosen_package, "stdin",
|
||||
&stdin_handle, sizeof(stdin_handle) );
|
||||
|
||||
stdin_handle = REV(stdin_handle);
|
||||
|
||||
MachVtbl.ConsPutChar = PpcPutChar;
|
||||
MachVtbl.ConsKbHit = PpcConsKbHit;
|
||||
MachVtbl.ConsGetCh = PpcConsGetCh;
|
||||
|
||||
printf("chosen_package = %x\n", chosen_package);
|
||||
|
||||
MachVtbl.VideoClearScreen = PpcVideoClearScreen;
|
||||
MachVtbl.VideoSetDisplayMode = PpcVideoSetDisplayMode;
|
||||
MachVtbl.VideoGetDisplaySize = PpcVideoGetDisplaySize;
|
||||
MachVtbl.VideoGetBufferSize = PpcVideoGetBufferSize;
|
||||
MachVtbl.VideoSetTextCursorPosition = PpcVideoSetTextCursorPosition;
|
||||
MachVtbl.VideoHideShowTextCursor = PpcVideoHideShowTextCursor;
|
||||
MachVtbl.VideoPutChar = PpcVideoPutChar;
|
||||
MachVtbl.VideoCopyOffScreenBufferToVRAM =
|
||||
PpcVideoCopyOffScreenBufferToVRAM;
|
||||
MachVtbl.VideoIsPaletteFixed = PpcVideoIsPaletteFixed;
|
||||
MachVtbl.VideoSetPaletteColor = PpcVideoSetPaletteColor;
|
||||
MachVtbl.VideoGetPaletteColor = PpcVideoGetPaletteColor;
|
||||
MachVtbl.VideoSync = PpcVideoSync;
|
||||
MachVtbl.VideoPrepareForReactOS = PpcVideoPrepareForReactOS;
|
||||
|
||||
MachVtbl.GetMemoryMap = PpcGetMemoryMap;
|
||||
|
||||
MachVtbl.DiskReadLogicalSectors = PpcDiskReadLogicalSectors;
|
||||
MachVtbl.DiskGetPartitionEntry = PpcDiskGetPartitionEntry;
|
||||
MachVtbl.DiskGetDriveGeometry = PpcDiskGetDriveGeometry;
|
||||
MachVtbl.DiskGetCacheableBlockCount = PpcDiskGetCacheableBlockCount;
|
||||
|
||||
MachVtbl.RTCGetCurrentDateTime = PpcRTCGetCurrentDateTime;
|
||||
|
||||
MachVtbl.HwDetect = PpcHwDetect;
|
||||
|
||||
printf( "FreeLDR version [%s]\n", GetFreeLoaderVersionString() );
|
||||
BootMain("freeldr-ppc");
|
||||
}
|
||||
|
||||
void MachInit(char *CmdLine) {
|
||||
int len;
|
||||
printf( "Determining boot device:\n" );
|
||||
len = ofw_getprop(chosen_package, "bootpath",
|
||||
BootPath, sizeof(BootPath));
|
||||
printf( "Got %d bytes of path\n", len );
|
||||
BootPath[len] = 0;
|
||||
printf( "Boot Path: %s\n", BootPath );
|
||||
|
||||
printf( "FreeLDR starting\n" );
|
||||
}
|
||||
|
||||
void FrLdrSetupPageDirectory() {
|
||||
}
|
||||
|
||||
void beep() {
|
||||
}
|
||||
|
||||
UCHAR STDCALL READ_PORT_UCHAR(PUCHAR Address) {
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
void WRITE_PORT_UCHAR(PUCHAR Address, UCHAR Value) {
|
||||
}
|
@@ -49,6 +49,13 @@ VOID RunLoader(VOID)
|
||||
LONG TimeOut;
|
||||
ULONG SelectedOperatingSystem;
|
||||
|
||||
if (!FsOpenBootVolume())
|
||||
{
|
||||
printf("Error opening boot partition for file access.\n");
|
||||
MachConsGetCh();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IniFileInitialize())
|
||||
{
|
||||
printf("Press any key to reboot.\n");
|
||||
|
@@ -28,7 +28,8 @@
|
||||
|
||||
BOOL DiskGetActivePartitionEntry(ULONG DriveNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry)
|
||||
{
|
||||
ULONG BootablePartitionCount = 0;
|
||||
ULONG BootablePartitionCount = 0;
|
||||
ULONG ActivePartition = 0;
|
||||
MASTER_BOOT_RECORD MasterBootRecord;
|
||||
|
||||
// Read master boot record
|
||||
@@ -41,22 +42,22 @@ BOOL DiskGetActivePartitionEntry(ULONG DriveNumber, PPARTITION_TABLE_ENTRY Parti
|
||||
if (MasterBootRecord.PartitionTable[0].BootIndicator == 0x80)
|
||||
{
|
||||
BootablePartitionCount++;
|
||||
BootPartition = 0;
|
||||
ActivePartition = 0;
|
||||
}
|
||||
if (MasterBootRecord.PartitionTable[1].BootIndicator == 0x80)
|
||||
{
|
||||
BootablePartitionCount++;
|
||||
BootPartition = 1;
|
||||
ActivePartition = 1;
|
||||
}
|
||||
if (MasterBootRecord.PartitionTable[2].BootIndicator == 0x80)
|
||||
{
|
||||
BootablePartitionCount++;
|
||||
BootPartition = 2;
|
||||
ActivePartition = 2;
|
||||
}
|
||||
if (MasterBootRecord.PartitionTable[3].BootIndicator == 0x80)
|
||||
{
|
||||
BootablePartitionCount++;
|
||||
BootPartition = 3;
|
||||
ActivePartition = 3;
|
||||
}
|
||||
|
||||
// Make sure there was only one bootable partition
|
||||
@@ -72,7 +73,7 @@ BOOL DiskGetActivePartitionEntry(ULONG DriveNumber, PPARTITION_TABLE_ENTRY Parti
|
||||
}
|
||||
|
||||
// Copy the partition table entry
|
||||
RtlCopyMemory(PartitionTableEntry, &MasterBootRecord.PartitionTable[BootPartition], sizeof(PARTITION_TABLE_ENTRY));
|
||||
RtlCopyMemory(PartitionTableEntry, &MasterBootRecord.PartitionTable[ActivePartition], sizeof(PARTITION_TABLE_ENTRY));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@@ -31,7 +31,7 @@ VOID BootMain(char *CmdLine)
|
||||
{
|
||||
CmdLineParse(CmdLine);
|
||||
|
||||
MachInit();
|
||||
MachInit(CmdLine);
|
||||
|
||||
DebugInit();
|
||||
|
||||
|
@@ -51,110 +51,78 @@ VOID FileSystemError(PUCHAR ErrorString)
|
||||
|
||||
/*
|
||||
*
|
||||
* BOOL FsOpenVolume(ULONG DriveNumber, ULONG PartitionNumber);
|
||||
* BOOL FsOpenVolume(ULONG DriveNumber, ULONGLONG StartSector, ULONGLONG SectorCount, int Type);
|
||||
*
|
||||
* This function is called to open a disk volume for file access.
|
||||
* It must be called before any of the file functions will work.
|
||||
* It takes two parameters:
|
||||
*
|
||||
* Drive: The BIOS drive number of the disk to open
|
||||
* Partition: This is zero for floppy drives.
|
||||
* If the disk is a hard disk then this specifies
|
||||
* The partition number to open (1 - 4)
|
||||
* If it is zero then it opens the active (bootable) partition
|
||||
*
|
||||
*/
|
||||
BOOL FsOpenVolume(ULONG DriveNumber, ULONG PartitionNumber)
|
||||
static BOOL FsOpenVolume(ULONG DriveNumber, ULONGLONG StartSector, ULONGLONG SectorCount, int Type)
|
||||
{
|
||||
PARTITION_TABLE_ENTRY PartitionTableEntry;
|
||||
UCHAR ErrorText[80];
|
||||
UCHAR VolumeType;
|
||||
UCHAR ErrorText[80];
|
||||
|
||||
DbgPrint((DPRINT_FILESYSTEM, "FsOpenVolume() DriveNumber: 0x%x PartitionNumber: 0x%x\n", DriveNumber, PartitionNumber));
|
||||
FsType = Type;
|
||||
|
||||
// Check and see if it is a floppy drive
|
||||
// If so then just assume FAT12 file system type
|
||||
if (DiskIsDriveRemovable(DriveNumber))
|
||||
switch (FsType)
|
||||
{
|
||||
DbgPrint((DPRINT_FILESYSTEM, "Drive is a floppy diskette drive. Assuming FAT12 file system.\n"));
|
||||
|
||||
FsType = FS_FAT;
|
||||
return FatOpenVolume(DriveNumber, 0, 0);
|
||||
}
|
||||
|
||||
// Check for ISO9660 file system type
|
||||
if (DriveNumber >= 0x80 && FsRecIsIso9660(DriveNumber))
|
||||
{
|
||||
DbgPrint((DPRINT_FILESYSTEM, "Drive is a cdrom drive. Assuming ISO-9660 file system.\n"));
|
||||
|
||||
FsType = FS_ISO9660;
|
||||
case FS_FAT:
|
||||
return FatOpenVolume(DriveNumber, StartSector, SectorCount);
|
||||
case FS_EXT2:
|
||||
return Ext2OpenVolume(DriveNumber, StartSector);
|
||||
case FS_NTFS:
|
||||
return NtfsOpenVolume(DriveNumber, StartSector);
|
||||
case FS_ISO9660:
|
||||
return IsoOpenVolume(DriveNumber);
|
||||
}
|
||||
|
||||
// Set the boot partition
|
||||
BootPartition = PartitionNumber;
|
||||
|
||||
// Get the requested partition entry
|
||||
if (PartitionNumber == 0)
|
||||
{
|
||||
// Partition requested was zero which means the boot partition
|
||||
if (DiskGetActivePartitionEntry(DriveNumber, &PartitionTableEntry) == FALSE)
|
||||
{
|
||||
FileSystemError("No active partition.");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get requested partition
|
||||
if (MachDiskGetPartitionEntry(DriveNumber, PartitionNumber, &PartitionTableEntry) == FALSE)
|
||||
{
|
||||
FileSystemError("Partition not found.");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// Check for valid partition
|
||||
if (PartitionTableEntry.SystemIndicator == PARTITION_ENTRY_UNUSED)
|
||||
{
|
||||
FileSystemError("Invalid partition.");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Try to recognize the file system
|
||||
if (!FsRecognizeVolume(DriveNumber, PartitionTableEntry.SectorCountBeforePartition, &VolumeType))
|
||||
{
|
||||
FileSystemError("Unrecognized file system.");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//switch (PartitionTableEntry.SystemIndicator)
|
||||
switch (VolumeType)
|
||||
{
|
||||
case PARTITION_FAT_12:
|
||||
case PARTITION_FAT_16:
|
||||
case PARTITION_HUGE:
|
||||
case PARTITION_XINT13:
|
||||
case PARTITION_FAT32:
|
||||
case PARTITION_FAT32_XINT13:
|
||||
FsType = FS_FAT;
|
||||
return FatOpenVolume(DriveNumber, PartitionTableEntry.SectorCountBeforePartition, PartitionTableEntry.PartitionSectorCount);
|
||||
case PARTITION_EXT2:
|
||||
FsType = FS_EXT2;
|
||||
return Ext2OpenVolume(DriveNumber, PartitionTableEntry.SectorCountBeforePartition);
|
||||
case PARTITION_NTFS:
|
||||
FsType = FS_NTFS;
|
||||
return NtfsOpenVolume(DriveNumber, PartitionTableEntry.SectorCountBeforePartition);
|
||||
default:
|
||||
FsType = 0;
|
||||
sprintf(ErrorText, "Unsupported file system. Type: 0x%x", VolumeType);
|
||||
sprintf(ErrorText, "Unsupported file system. Type: 0x%x", Type);
|
||||
FileSystemError(ErrorText);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
/*
|
||||
*
|
||||
* BOOL FsOpenBootVolume()
|
||||
*
|
||||
* This function is called to open the boot disk volume for file access.
|
||||
* It must be called before any of the file functions will work.
|
||||
*/
|
||||
BOOL FsOpenBootVolume()
|
||||
{
|
||||
ULONG DriveNumber;
|
||||
ULONGLONG StartSector;
|
||||
ULONGLONG SectorCount;
|
||||
int Type;
|
||||
|
||||
if (! MachDiskGetBootVolume(&DriveNumber, &StartSector, &SectorCount, &Type))
|
||||
{
|
||||
FileSystemError("Unable to locate boot partition\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return FsOpenVolume(DriveNumber, StartSector, SectorCount, Type);
|
||||
}
|
||||
|
||||
BOOL FsOpenSystemVolume(char *SystemPath, char *RemainingPath, PULONG Device)
|
||||
{
|
||||
ULONG DriveNumber;
|
||||
ULONGLONG StartSector;
|
||||
ULONGLONG SectorCount;
|
||||
int Type;
|
||||
|
||||
if (! MachDiskGetSystemVolume(SystemPath, RemainingPath, Device,
|
||||
&DriveNumber, &StartSector, &SectorCount,
|
||||
&Type))
|
||||
{
|
||||
FileSystemError("Unable to locate system partition\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return FsOpenVolume(DriveNumber, StartSector, SectorCount, Type);
|
||||
}
|
||||
|
||||
|
||||
PFILE FsOpenFile(PUCHAR FileName)
|
||||
{
|
||||
PFILE FileHandle = NULL;
|
||||
|
@@ -38,8 +38,6 @@
|
||||
#define ROUND_DOWN(N, S) ((N) & ~((S) - 1))
|
||||
#define Ke386EraseFlags(x) __asm__ __volatile__("pushl $0 ; popfl\n")
|
||||
|
||||
extern ULONG BootDrive; /* BIOS boot drive, 0-A:, 1-B:, 0x80-C:, 0x81-D:, etc. */
|
||||
extern ULONG BootPartition; /* Boot Partition, 1-4 */
|
||||
extern BOOL UserInterfaceUp; /* Tells us if the user interface is displayed */
|
||||
|
||||
VOID BootMain(LPSTR CmdLine);
|
||||
|
@@ -33,7 +33,8 @@
|
||||
#define PFILE FILE *
|
||||
|
||||
VOID FileSystemError(PUCHAR ErrorString);
|
||||
BOOL FsOpenVolume(ULONG DriveNumber, ULONG PartitionNumber);
|
||||
BOOL FsOpenBootVolume();
|
||||
BOOL FsOpenSystemVolume(char *SystemPath, char *RemainingPath, PULONG BootDevice);
|
||||
PFILE FsOpenFile(PUCHAR FileName);
|
||||
VOID FsCloseFile(PFILE FileHandle);
|
||||
BOOL FsReadFile(PFILE FileHandle, ULONG BytesToRead, ULONG* BytesRead, PVOID Buffer);
|
||||
|
@@ -56,6 +56,11 @@ typedef struct tagMACHVTBL
|
||||
|
||||
ULONG (*GetMemoryMap)(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize);
|
||||
|
||||
BOOL (*DiskGetBootVolume)(PULONG DriveNumber, PULONGLONG StartSector, PULONGLONG SectorCount, int *FsType);
|
||||
BOOL (*DiskGetSystemVolume)(char *SystemPath, char *RemainingPath, PULONG Device, PULONG DriveNumber, PULONGLONG StartSector, PULONGLONG SectorCount, int *FsType);
|
||||
BOOL (*DiskGetBootPath)(char *BootPath, unsigned Size);
|
||||
VOID (*DiskGetBootDevice)(PULONG BootDevice);
|
||||
BOOL (*DiskBootingFromFloppy)(VOID);
|
||||
BOOL (*DiskReadLogicalSectors)(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer);
|
||||
BOOL (*DiskGetPartitionEntry)(ULONG DriveNumber, ULONG PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry);
|
||||
BOOL (*DiskGetDriveGeometry)(ULONG DriveNumber, PGEOMETRY DriveGeometry);
|
||||
@@ -66,7 +71,7 @@ typedef struct tagMACHVTBL
|
||||
VOID (*HwDetect)(VOID);
|
||||
} MACHVTBL, *PMACHVTBL;
|
||||
|
||||
VOID MachInit(VOID);
|
||||
VOID MachInit(char *CmdLine);
|
||||
|
||||
extern MACHVTBL MachVtbl;
|
||||
|
||||
@@ -87,6 +92,11 @@ extern MACHVTBL MachVtbl;
|
||||
#define MachVideoSync() MachVtbl.VideoSync()
|
||||
#define MachVideoPrepareForReactOS() MachVtbl.VideoPrepareForReactOS()
|
||||
#define MachGetMemoryMap(MMap, Size) MachVtbl.GetMemoryMap((MMap), (Size))
|
||||
#define MachDiskGetBootVolume(Drv, Start, Cnt, FsType) MachVtbl.DiskGetBootVolume((Drv), (Start), (Cnt), (FsType))
|
||||
#define MachDiskGetSystemVolume(SysPath, RemPath, Dev, Drv, Start, Cnt, FsType) MachVtbl.DiskGetSystemVolume((SysPath), (RemPath), (Dev), (Drv), (Start), (Cnt), (FsType))
|
||||
#define MachDiskGetBootPath(Path, Size) MachVtbl.DiskGetBootPath((Path), (Size))
|
||||
#define MachDiskGetBootDevice(BootDevice) MachVtbl.DiskGetBootDevice(BootDevice)
|
||||
#define MachDiskBootingFromFloppy() MachVtbl.DiskBootingFromFloppy()
|
||||
#define MachDiskReadLogicalSectors(Drive, Start, Count, Buf) MachVtbl.DiskReadLogicalSectors((Drive), (Start), (Count), (Buf))
|
||||
#define MachDiskGetPartitionEntry(Drive, Part, Entry) MachVtbl.DiskGetPartitionEntry((Drive), (Part), (Entry))
|
||||
#define MachDiskGetDriveGeometry(Drive, Geom) MachVtbl.DiskGetDriveGeometry((Drive), (Geom))
|
||||
|
@@ -57,7 +57,7 @@ extern PINI_SECTION IniFileSectionListHead;
|
||||
extern ULONG IniFileSectionCount;
|
||||
extern ULONG IniFileSettingCount;
|
||||
|
||||
PFILE IniOpenIniFile(UCHAR BootDriveNumber, UCHAR BootPartitionNumber);
|
||||
PFILE IniOpenIniFile();
|
||||
|
||||
BOOL IniParseFile(PUCHAR IniFileData, ULONG IniFileSize);
|
||||
ULONG IniGetNextLineSize(PUCHAR IniFileData, ULONG IniFileSize, ULONG CurrentOffset);
|
||||
|
@@ -33,22 +33,7 @@ BOOL IniFileInitialize(VOID)
|
||||
BOOL Success;
|
||||
|
||||
// Open freeldr.ini
|
||||
// BootDrive & BootPartition are passed
|
||||
// in from the boot sector code in the
|
||||
// DL & DH registers.
|
||||
Freeldr_Ini = IniOpenIniFile(BootDrive, BootPartition);
|
||||
|
||||
// If we couldn't open freeldr.ini on the partition
|
||||
// they specified in the boot sector then try
|
||||
// opening the active (boot) partition.
|
||||
if ((Freeldr_Ini == NULL) && (BootPartition != 0))
|
||||
{
|
||||
BootPartition = 0;
|
||||
|
||||
Freeldr_Ini = IniOpenIniFile(BootDrive, BootPartition);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
Freeldr_Ini = IniOpenIniFile();
|
||||
|
||||
if (Freeldr_Ini == NULL)
|
||||
{
|
||||
@@ -87,24 +72,10 @@ BOOL IniFileInitialize(VOID)
|
||||
return Success;
|
||||
}
|
||||
|
||||
PFILE IniOpenIniFile(UCHAR BootDriveNumber, UCHAR BootPartitionNumber)
|
||||
PFILE IniOpenIniFile()
|
||||
{
|
||||
PFILE IniFileHandle; // File handle for freeldr.ini
|
||||
|
||||
if (!FsOpenVolume(BootDriveNumber, BootPartitionNumber))
|
||||
{
|
||||
if (BootPartitionNumber == 0)
|
||||
{
|
||||
printf("Error opening active (bootable) partition on boot drive 0x%x for file access.\n", BootDriveNumber);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Error opening partition %d on boot drive 0x%x for file access.\n", BootPartitionNumber, BootDriveNumber);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Try to open freeldr.ini
|
||||
IniFileHandle = FsOpenFile("freeldr.ini");
|
||||
|
||||
|
@@ -40,18 +40,19 @@
|
||||
|
||||
PLINUX_BOOTSECTOR LinuxBootSector = NULL;
|
||||
PLINUX_SETUPSECTOR LinuxSetupSector = NULL;
|
||||
ULONG SetupSectorSize = 0;
|
||||
BOOL NewStyleLinuxKernel = FALSE;
|
||||
ULONG LinuxKernelSize = 0;
|
||||
ULONG LinuxInitrdSize = 0;
|
||||
UCHAR LinuxKernelName[260];
|
||||
UCHAR LinuxInitrdName[260];
|
||||
BOOL LinuxHasInitrd = FALSE;
|
||||
UCHAR LinuxCommandLine[260] = "";
|
||||
ULONG LinuxCommandLineSize = 0;
|
||||
PVOID LinuxKernelLoadAddress = NULL;
|
||||
PVOID LinuxInitrdLoadAddress = NULL;
|
||||
UCHAR LinuxBootDescription[80];
|
||||
ULONG SetupSectorSize = 0;
|
||||
BOOL NewStyleLinuxKernel = FALSE;
|
||||
ULONG LinuxKernelSize = 0;
|
||||
ULONG LinuxInitrdSize = 0;
|
||||
UCHAR LinuxKernelName[260];
|
||||
UCHAR LinuxInitrdName[260];
|
||||
BOOL LinuxHasInitrd = FALSE;
|
||||
UCHAR LinuxCommandLine[260] = "";
|
||||
ULONG LinuxCommandLineSize = 0;
|
||||
PVOID LinuxKernelLoadAddress = NULL;
|
||||
PVOID LinuxInitrdLoadAddress = NULL;
|
||||
UCHAR LinuxBootDescription[80];
|
||||
UCHAR LinuxBootPath[260] = "";
|
||||
|
||||
VOID LoadAndBootLinux(PUCHAR OperatingSystemName, PUCHAR Description)
|
||||
{
|
||||
@@ -80,7 +81,7 @@ VOID LoadAndBootLinux(PUCHAR OperatingSystemName, PUCHAR Description)
|
||||
}
|
||||
|
||||
// Open the boot volume
|
||||
if (!FsOpenVolume(BootDrive, BootPartition))
|
||||
if (!FsOpenSystemVolume(LinuxBootPath, NULL, NULL))
|
||||
{
|
||||
UiMessageBox("Failed to open boot drive.");
|
||||
goto LinuxBootFailed;
|
||||
@@ -226,8 +227,7 @@ LinuxBootFailed:
|
||||
BOOL LinuxParseIniSection(PUCHAR OperatingSystemName)
|
||||
{
|
||||
UCHAR SettingName[260];
|
||||
UCHAR SettingValue[260];
|
||||
ULONG SectionId;
|
||||
ULONG SectionId;
|
||||
|
||||
// Find all the message box settings and run them
|
||||
UiShowMessageBoxesInSection(OperatingSystemName);
|
||||
@@ -240,20 +240,12 @@ BOOL LinuxParseIniSection(PUCHAR OperatingSystemName)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!IniReadSettingByName(SectionId, "BootDrive", SettingValue, 260))
|
||||
if (!IniReadSettingByName(SectionId, "BootPath", LinuxBootPath, 260))
|
||||
{
|
||||
UiMessageBox("Boot drive not specified for selected OS!");
|
||||
UiMessageBox("Boot path not specified for selected OS!");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BootDrive = DriveMapGetBiosDriveNumber(SettingValue);
|
||||
|
||||
BootPartition = 0;
|
||||
if (IniReadSettingByName(SectionId, "BootPartition", SettingValue, 260))
|
||||
{
|
||||
BootPartition = atoi(SettingValue);
|
||||
}
|
||||
|
||||
// Get the kernel name
|
||||
if (!IniReadSettingByName(SectionId, "Kernel", LinuxKernelName, 260))
|
||||
{
|
||||
|
@@ -37,6 +37,11 @@
|
||||
#undef MachVideoSync
|
||||
#undef MachVideoPrepareForReactOS
|
||||
#undef MachGetMemoryMap
|
||||
#undef MachDiskGetBootVolume
|
||||
#undef MachDiskGetSystemVolume
|
||||
#undef MachDiskGetBootPath
|
||||
#undef MachDiskGetBootDevice
|
||||
#undef MachDiskBootingFromFloppy
|
||||
#undef MachDiskReadLogicalSectors
|
||||
#undef MachDiskGetPartitionEntry
|
||||
#undef MachDiskGetDriveGeometry
|
||||
@@ -148,6 +153,44 @@ MachGetMemoryMap(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize)
|
||||
return MachVtbl.GetMemoryMap(BiosMemoryMap, MaxMemoryMapSize);
|
||||
}
|
||||
|
||||
BOOL
|
||||
MachDiskGetBootVolume(PULONG DriveNumber, PULONGLONG StartSector, PULONGLONG SectorCount, int *FsType)
|
||||
{
|
||||
return MachVtbl.DiskGetBootVolume(DriveNumber, StartSector, SectorCount, FsType);
|
||||
}
|
||||
|
||||
BOOL
|
||||
MachDiskGetSystemVolume(char *SystemPath,
|
||||
char *RemainingPath,
|
||||
PULONG Device,
|
||||
PULONG DriveNumber,
|
||||
PULONGLONG StartSector,
|
||||
PULONGLONG SectorCount,
|
||||
int *FsType)
|
||||
{
|
||||
return MachVtbl.DiskGetSystemVolume(SystemPath, RemainingPath, Device,
|
||||
DriveNumber, StartSector, SectorCount,
|
||||
FsType);
|
||||
}
|
||||
|
||||
BOOL
|
||||
MachDiskGetBootPath(char *BootPath, unsigned Size)
|
||||
{
|
||||
return MachVtbl.DiskGetBootPath(BootPath, Size);
|
||||
}
|
||||
|
||||
VOID
|
||||
MachDiskGetBootDevice(PULONG BootDevice)
|
||||
{
|
||||
MachVtbl.DiskGetBootDevice(BootDevice);
|
||||
}
|
||||
|
||||
BOOL
|
||||
MachDiskBootingFromFloppy()
|
||||
{
|
||||
return MachVtbl.DiskBootingFromFloppy();
|
||||
}
|
||||
|
||||
BOOL
|
||||
MachDiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer)
|
||||
{
|
||||
|
@@ -38,6 +38,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
||||
*/
|
||||
#ifdef __i386__
|
||||
#include "i386.h"
|
||||
#elif defined(_M_PPC)
|
||||
#include "powerpc.h"
|
||||
#endif
|
||||
#define L_clz
|
||||
#define L_udivdi3
|
||||
|
3208
reactos/boot/freeldr/freeldr/math/powerpc.h
Normal file
3208
reactos/boot/freeldr/freeldr/math/powerpc.h
Normal file
File diff suppressed because it is too large
Load Diff
@@ -33,10 +33,9 @@ VOID LoadAndBootBootSector(PUCHAR OperatingSystemName)
|
||||
{
|
||||
PFILE FilePointer;
|
||||
UCHAR SettingName[80];
|
||||
UCHAR SettingValue[80];
|
||||
ULONG SectionId;
|
||||
ULONG SectionId;
|
||||
UCHAR FileName[260];
|
||||
ULONG BytesRead;
|
||||
ULONG BytesRead;
|
||||
|
||||
// Find all the message box settings and run them
|
||||
UiShowMessageBoxesInSection(OperatingSystemName);
|
||||
@@ -49,27 +48,13 @@ VOID LoadAndBootBootSector(PUCHAR OperatingSystemName)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IniReadSettingByName(SectionId, "BootDrive", SettingValue, 80))
|
||||
{
|
||||
UiMessageBox("Boot drive not specified for selected OS!");
|
||||
return;
|
||||
}
|
||||
|
||||
BootDrive = DriveMapGetBiosDriveNumber(SettingValue);
|
||||
|
||||
BootPartition = 0;
|
||||
if (IniReadSettingByName(SectionId, "BootPartition", SettingValue, 80))
|
||||
{
|
||||
BootPartition = atoi(SettingValue);
|
||||
}
|
||||
|
||||
if (!IniReadSettingByName(SectionId, "BootSectorFile", FileName, 260))
|
||||
{
|
||||
UiMessageBox("Boot sector file not specified for selected OS!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!FsOpenVolume(BootDrive, BootPartition))
|
||||
if (!FsOpenSystemVolume(FileName, FileName, NULL))
|
||||
{
|
||||
UiMessageBox("Failed to open boot drive.");
|
||||
return;
|
||||
@@ -111,10 +96,12 @@ VOID LoadAndBootBootSector(PUCHAR OperatingSystemName)
|
||||
|
||||
VOID LoadAndBootPartition(PUCHAR OperatingSystemName)
|
||||
{
|
||||
UCHAR SettingName[80];
|
||||
UCHAR SettingValue[80];
|
||||
ULONG SectionId;
|
||||
UCHAR SettingName[80];
|
||||
UCHAR SettingValue[80];
|
||||
ULONG SectionId;
|
||||
PARTITION_TABLE_ENTRY PartitionTableEntry;
|
||||
ULONG DriveNumber;
|
||||
ULONG PartitionNumber;
|
||||
|
||||
// Find all the message box settings and run them
|
||||
UiShowMessageBoxesInSection(OperatingSystemName);
|
||||
@@ -134,7 +121,7 @@ VOID LoadAndBootPartition(PUCHAR OperatingSystemName)
|
||||
return;
|
||||
}
|
||||
|
||||
BootDrive = DriveMapGetBiosDriveNumber(SettingValue);
|
||||
DriveNumber = DriveMapGetBiosDriveNumber(SettingValue);
|
||||
|
||||
// Read the boot partition
|
||||
if (!IniReadSettingByName(SectionId, "BootPartition", SettingValue, 80))
|
||||
@@ -143,17 +130,17 @@ VOID LoadAndBootPartition(PUCHAR OperatingSystemName)
|
||||
return;
|
||||
}
|
||||
|
||||
BootPartition = atoi(SettingValue);
|
||||
PartitionNumber = atoi(SettingValue);
|
||||
|
||||
// Get the partition table entry
|
||||
if (!DiskGetPartitionEntry(BootDrive, BootPartition, &PartitionTableEntry))
|
||||
if (!DiskGetPartitionEntry(DriveNumber, PartitionNumber, &PartitionTableEntry))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Now try to read the partition boot sector
|
||||
// If this fails then abort
|
||||
if (!MachDiskReadLogicalSectors(BootDrive, PartitionTableEntry.SectorCountBeforePartition, 1, (PVOID)0x7C00))
|
||||
if (!MachDiskReadLogicalSectors(DriveNumber, PartitionTableEntry.SectorCountBeforePartition, 1, (PVOID)0x7C00))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -182,7 +169,8 @@ VOID LoadAndBootDrive(PUCHAR OperatingSystemName)
|
||||
{
|
||||
UCHAR SettingName[80];
|
||||
UCHAR SettingValue[80];
|
||||
ULONG SectionId;
|
||||
ULONG SectionId;
|
||||
ULONG DriveNumber;
|
||||
|
||||
// Find all the message box settings and run them
|
||||
UiShowMessageBoxesInSection(OperatingSystemName);
|
||||
@@ -201,11 +189,11 @@ VOID LoadAndBootDrive(PUCHAR OperatingSystemName)
|
||||
return;
|
||||
}
|
||||
|
||||
BootDrive = DriveMapGetBiosDriveNumber(SettingValue);
|
||||
DriveNumber = DriveMapGetBiosDriveNumber(SettingValue);
|
||||
|
||||
// Now try to read the boot sector (or mbr)
|
||||
// If this fails then abort
|
||||
if (!MachDiskReadLogicalSectors(BootDrive, 0, 1, (PVOID)0x7C00))
|
||||
if (!MachDiskReadLogicalSectors(DriveNumber, 0, 1, (PVOID)0x7C00))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@@ -22,11 +22,11 @@
|
||||
#define __MEM_H
|
||||
|
||||
|
||||
#ifdef __i386__
|
||||
#if defined(__i386__) || defined(_PPC_)
|
||||
|
||||
#define MM_PAGE_SIZE 4096
|
||||
|
||||
#endif // defined __i386__
|
||||
#endif // defined __i386__ or _PPC_
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@@ -43,7 +43,21 @@ BOOL DissectArcPath(char *ArcPath, char *BootPath, ULONG* BootDrive, ULONG* Boot
|
||||
if (p == NULL)
|
||||
return FALSE;
|
||||
p++;
|
||||
*BootPartition = 0;
|
||||
*BootPartition = 0xff;
|
||||
}
|
||||
else if (strnicmp(p, "cdrom(", 6) == 0)
|
||||
{
|
||||
/*
|
||||
* cdrom path:
|
||||
* multi(0)disk(0)cdrom(x)\path
|
||||
*/
|
||||
p = p + 6;
|
||||
*BootDrive = atoi(p);
|
||||
p = strchr(p, ')');
|
||||
if (p == NULL)
|
||||
return FALSE;
|
||||
p++;
|
||||
*BootPartition = 0xff;
|
||||
}
|
||||
else if (strnicmp(p, "rdisk(", 6) == 0)
|
||||
{
|
||||
|
@@ -15,16 +15,6 @@
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
#define IsRecognizedPartition(P) \
|
||||
((P) == PARTITION_FAT_12 || \
|
||||
(P) == PARTITION_FAT_16 || \
|
||||
(P) == PARTITION_HUGE || \
|
||||
(P) == PARTITION_IFS || \
|
||||
(P) == PARTITION_EXT2 || \
|
||||
(P) == PARTITION_FAT32 || \
|
||||
(P) == PARTITION_FAT32_XINT13 || \
|
||||
(P) == PARTITION_XINT13)
|
||||
|
||||
BOOL
|
||||
STDCALL
|
||||
FrLdrLoadKernel(PCHAR szFileName,
|
||||
@@ -564,6 +554,7 @@ LoadAndBootReactOS(PUCHAR OperatingSystemName)
|
||||
PFILE FilePointer;
|
||||
CHAR name[1024];
|
||||
CHAR value[1024];
|
||||
CHAR SystemPath[1024];
|
||||
CHAR szKernelName[1024];
|
||||
CHAR szHalName[1024];
|
||||
CHAR szFileName[1024];
|
||||
@@ -574,9 +565,6 @@ LoadAndBootReactOS(PUCHAR OperatingSystemName)
|
||||
|
||||
ULONG_PTR Base;
|
||||
ULONG Size;
|
||||
|
||||
PARTITION_TABLE_ENTRY PartitionTableEntry;
|
||||
ULONG rosPartition;
|
||||
|
||||
extern ULONG PageDirectoryStart;
|
||||
extern ULONG PageDirectoryEnd;
|
||||
@@ -645,7 +633,7 @@ LoadAndBootReactOS(PUCHAR OperatingSystemName)
|
||||
/*
|
||||
* Make sure the system path is set in the .ini file
|
||||
*/
|
||||
if (!IniReadSettingByName(SectionId, "SystemPath", value, 1024))
|
||||
if (!IniReadSettingByName(SectionId, "SystemPath", SystemPath, sizeof(SystemPath)))
|
||||
{
|
||||
UiMessageBox("System path not specified for selected operating system.");
|
||||
return;
|
||||
@@ -654,62 +642,20 @@ LoadAndBootReactOS(PUCHAR OperatingSystemName)
|
||||
/*
|
||||
* Special case for Live CD.
|
||||
*/
|
||||
if (!stricmp(value, "LiveCD"))
|
||||
if (!stricmp(SystemPath, "LiveCD"))
|
||||
{
|
||||
strcpy(szBootPath, "\\reactos");
|
||||
|
||||
/* Set kernel command line */
|
||||
sprintf(multiboot_kernel_cmdline,
|
||||
"multi(0)disk(0)cdrom(%u)\\reactos /MININT",
|
||||
(unsigned int)BootDrive);
|
||||
/* Normalize */
|
||||
MachDiskGetBootPath(SystemPath, sizeof(SystemPath));
|
||||
strcat(SystemPath, "\\reactos");
|
||||
strcat(strcpy(multiboot_kernel_cmdline, SystemPath),
|
||||
" /MININT");
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Verify system path
|
||||
*/
|
||||
if (!DissectArcPath(value, szBootPath, &BootDrive, &BootPartition))
|
||||
{
|
||||
sprintf(MsgBuffer,"Invalid system path: '%s'", value);
|
||||
UiMessageBox(MsgBuffer);
|
||||
return;
|
||||
}
|
||||
|
||||
/* recalculate the boot partition for freeldr */
|
||||
i = 0;
|
||||
rosPartition = 0;
|
||||
while (1)
|
||||
{
|
||||
if (!MachDiskGetPartitionEntry(BootDrive, ++i, &PartitionTableEntry))
|
||||
{
|
||||
BootPartition = 0;
|
||||
break;
|
||||
}
|
||||
if (IsRecognizedPartition(PartitionTableEntry.SystemIndicator))
|
||||
{
|
||||
if (++rosPartition == BootPartition)
|
||||
{
|
||||
BootPartition = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (BootPartition == 0)
|
||||
{
|
||||
sprintf(MsgBuffer,"Invalid system path: '%s'", value);
|
||||
UiMessageBox(MsgBuffer);
|
||||
return;
|
||||
}
|
||||
|
||||
/* copy ARC path into kernel command line */
|
||||
strcpy(multiboot_kernel_cmdline, value);
|
||||
/* copy system path into kernel command line */
|
||||
strcpy(multiboot_kernel_cmdline, SystemPath);
|
||||
}
|
||||
|
||||
/* Set boot drive and partition */
|
||||
((LPSTR )(&LoaderBlock.BootDevice))[0] = (CHAR)BootDrive;
|
||||
((LPSTR )(&LoaderBlock.BootDevice))[1] = (CHAR)BootPartition;
|
||||
|
||||
/*
|
||||
* Read the optional kernel parameters (if any)
|
||||
*/
|
||||
@@ -719,13 +665,6 @@ LoadAndBootReactOS(PUCHAR OperatingSystemName)
|
||||
strcat(multiboot_kernel_cmdline, value);
|
||||
}
|
||||
|
||||
/* append a backslash */
|
||||
if ((strlen(szBootPath)==0) ||
|
||||
szBootPath[strlen(szBootPath)] != '\\')
|
||||
strcat(szBootPath, "\\");
|
||||
|
||||
DbgPrint((DPRINT_REACTOS,"SystemRoot: '%s'\n", szBootPath));
|
||||
|
||||
|
||||
UiDrawBackdrop();
|
||||
UiDrawStatusText("Detecting Hardware...");
|
||||
@@ -741,14 +680,21 @@ LoadAndBootReactOS(PUCHAR OperatingSystemName)
|
||||
UiDrawProgressBarCenter(0, 100, "Loading ReactOS...");
|
||||
|
||||
/*
|
||||
* Try to open boot drive
|
||||
* Try to open system drive
|
||||
*/
|
||||
if (!FsOpenVolume(BootDrive, BootPartition))
|
||||
if (!FsOpenSystemVolume(SystemPath, szBootPath, &LoaderBlock.BootDevice))
|
||||
{
|
||||
UiMessageBox("Failed to open boot drive.");
|
||||
return;
|
||||
}
|
||||
|
||||
/* append a backslash */
|
||||
if ((strlen(szBootPath)==0) ||
|
||||
szBootPath[strlen(szBootPath)] != '\\')
|
||||
strcat(szBootPath, "\\");
|
||||
|
||||
DbgPrint((DPRINT_REACTOS,"SystemRoot: '%s'\n", szBootPath));
|
||||
|
||||
/*
|
||||
* Find the kernel image name
|
||||
* and try to load the kernel off the disk
|
||||
|
@@ -312,13 +312,11 @@ VOID RunLoader(VOID)
|
||||
UiDrawStatusText("");
|
||||
#endif
|
||||
|
||||
/* set boot drive and partition */
|
||||
((char *)(&LoaderBlock.BootDevice))[0] = (char)BootDrive;
|
||||
((char *)(&LoaderBlock.BootDevice))[1] = (char)BootPartition;
|
||||
|
||||
/* set boot device */
|
||||
MachDiskGetBootDevice(&LoaderBlock.BootDevice);
|
||||
|
||||
/* Open boot drive */
|
||||
if (!FsOpenVolume(BootDrive, BootPartition))
|
||||
if (!FsOpenBootVolume())
|
||||
{
|
||||
#ifdef USE_UI
|
||||
UiMessageBox("Failed to open boot drive.");
|
||||
@@ -330,7 +328,7 @@ VOID RunLoader(VOID)
|
||||
|
||||
/* Open 'txtsetup.sif' */
|
||||
if (!InfOpenFile (&InfHandle,
|
||||
(BootDrive < 0x80) ? "\\txtsetup.sif" : "\\reactos\\txtsetup.sif",
|
||||
MachDiskBootingFromFloppy() ? "\\txtsetup.sif" : "\\reactos\\txtsetup.sif",
|
||||
&ErrorLine))
|
||||
{
|
||||
printf("Failed to open 'txtsetup.sif'\n");
|
||||
@@ -358,7 +356,7 @@ VOID RunLoader(VOID)
|
||||
printf("LoadOptions: '%s'\n", LoadOptions);
|
||||
#endif
|
||||
|
||||
if (BootDrive < 0x80)
|
||||
if (MachDiskBootingFromFloppy())
|
||||
{
|
||||
/* Boot from floppy disk */
|
||||
SourcePath = "\\";
|
||||
@@ -370,12 +368,9 @@ VOID RunLoader(VOID)
|
||||
}
|
||||
|
||||
/* Set kernel command line */
|
||||
sprintf(multiboot_kernel_cmdline,
|
||||
"multi(0)disk(0)%s(%u)%s %s",
|
||||
(BootDrive < 0x80) ? "fdisk" : "cdrom",
|
||||
(unsigned int)BootDrive,
|
||||
SourcePath,
|
||||
LoadOptions);
|
||||
MachDiskGetBootPath(multiboot_kernel_cmdline, sizeof(multiboot_kernel_cmdline));
|
||||
strcat(strcat(strcat(multiboot_kernel_cmdline, SourcePath), " "),
|
||||
LoadOptions);
|
||||
|
||||
/* Load ntoskrnl.exe */
|
||||
if (!LoadKernel(SourcePath, "ntoskrnl.exe"))
|
||||
@@ -400,7 +395,7 @@ for(;;);
|
||||
#endif
|
||||
|
||||
/* Insert boot disk 2 */
|
||||
if (BootDrive < 0x80)
|
||||
if (MachDiskBootingFromFloppy())
|
||||
{
|
||||
#ifdef USE_UI
|
||||
UiMessageBox("Please insert \"ReactOS Boot Disk 2\" and press ENTER");
|
||||
@@ -410,7 +405,7 @@ for(;;);
|
||||
#endif
|
||||
|
||||
/* Open boot drive */
|
||||
if (!FsOpenVolume(BootDrive, BootPartition))
|
||||
if (!FsOpenBootVolume())
|
||||
{
|
||||
#ifdef USE_UI
|
||||
UiMessageBox("Failed to open boot drive.");
|
||||
|
@@ -20,6 +20,7 @@
|
||||
#include <freeldr.h>
|
||||
#include <machine.h>
|
||||
#include <rtl.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
/*
|
||||
* print() - prints unformatted text to stdout
|
||||
@@ -38,12 +39,11 @@ void print(char *str)
|
||||
*/
|
||||
void printf(char *format, ... )
|
||||
{
|
||||
int *dataptr = (int *)(void *)&format;
|
||||
va_list ap;
|
||||
va_start(ap,format);
|
||||
char c, *ptr, str[16];
|
||||
int ll;
|
||||
|
||||
dataptr++;
|
||||
|
||||
while ((c = *(format++)))
|
||||
{
|
||||
if (c != '%')
|
||||
@@ -66,11 +66,11 @@ void printf(char *format, ... )
|
||||
case 'd': case 'u': case 'x':
|
||||
if (ll)
|
||||
{
|
||||
*convert_i64_to_ascii(str, c, *((unsigned long long *) dataptr++)) = 0;
|
||||
*convert_i64_to_ascii(str, c, va_arg(ap, unsigned long long)) = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
*convert_to_ascii(str, c, *((unsigned long *) dataptr++)) = 0;
|
||||
*convert_to_ascii(str, c, va_arg(ap, unsigned long)) = 0;
|
||||
}
|
||||
|
||||
ptr = str;
|
||||
@@ -81,10 +81,10 @@ void printf(char *format, ... )
|
||||
}
|
||||
break;
|
||||
|
||||
case 'c': MachConsPutChar((*(dataptr++))&0xff); break;
|
||||
case 'c': MachConsPutChar((va_arg(ap,int))&0xff); break;
|
||||
|
||||
case 's':
|
||||
ptr = (char *)(*(dataptr++));
|
||||
ptr = va_arg(ap,char *);
|
||||
|
||||
while ((c = *(ptr++)))
|
||||
{
|
||||
@@ -100,16 +100,18 @@ void printf(char *format, ... )
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void sprintf(char *buffer, char *format, ... )
|
||||
{
|
||||
int *dataptr = (int *)(void *)&format;
|
||||
va_list ap;
|
||||
char c, *ptr, str[16];
|
||||
char *p = buffer;
|
||||
int ll;
|
||||
|
||||
dataptr++;
|
||||
va_start(ap,format);
|
||||
|
||||
while ((c = *(format++)))
|
||||
{
|
||||
@@ -134,11 +136,11 @@ void sprintf(char *buffer, char *format, ... )
|
||||
case 'd': case 'u': case 'x':
|
||||
if (ll)
|
||||
{
|
||||
*convert_i64_to_ascii(str, c, *((unsigned long long*) dataptr++)) = 0;
|
||||
*convert_i64_to_ascii(str, c, va_arg(ap, unsigned long long)) = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
*convert_to_ascii(str, c, *((unsigned long *) dataptr++)) = 0;
|
||||
*convert_to_ascii(str, c, va_arg(ap, unsigned long)) = 0;
|
||||
}
|
||||
|
||||
ptr = str;
|
||||
@@ -151,12 +153,12 @@ void sprintf(char *buffer, char *format, ... )
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
*p = (*(dataptr++))&0xff;
|
||||
*p = va_arg(ap,int)&0xff;
|
||||
p++;
|
||||
break;
|
||||
|
||||
case 's':
|
||||
ptr = (char *)(*(dataptr++));
|
||||
ptr = va_arg(ap,char *);
|
||||
|
||||
while ((c = *(ptr++)))
|
||||
{
|
||||
@@ -174,5 +176,6 @@ void sprintf(char *buffer, char *format, ... )
|
||||
}
|
||||
}
|
||||
}
|
||||
va_end(ap);
|
||||
*p=0;
|
||||
}
|
||||
|
@@ -17,16 +17,15 @@
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* convert_to_ascii() - converts a number to it's ascii equivalent
|
||||
* from:
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 1996 Erich Boleyn <erich@uruk.org>
|
||||
*/
|
||||
char *convert_to_ascii(char *buf, int c, ...)
|
||||
char *convert_to_ascii(char *buf, int c, int num)
|
||||
{
|
||||
unsigned long num = *((&c) + 1), mult = 10;
|
||||
unsigned long mult = 10;
|
||||
char *ptr = buf;
|
||||
|
||||
if (c == 'x')
|
||||
@@ -63,9 +62,8 @@ char *convert_to_ascii(char *buf, int c, ...)
|
||||
return ptr;
|
||||
}
|
||||
|
||||
char *convert_i64_to_ascii(char *buf, int c, ...)
|
||||
char *convert_i64_to_ascii(char *buf, int c, unsigned long long num)
|
||||
{
|
||||
unsigned long long num = *(long long*)((&c) + 1);
|
||||
int mult = 10;
|
||||
char *ptr = buf;
|
||||
|
||||
|
@@ -13,9 +13,9 @@ HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall",,0x00000010
|
||||
HKLM,"SOFTWARE\Microsoft\Rpc",,0x00000012
|
||||
|
||||
; Version Information
|
||||
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion","CurrentVersion",0x00020000,"4.0"
|
||||
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion","CSDVersion",0x00020000,"Service Pack 6"
|
||||
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion","CurrentBuildNumber",0x00020000,"1381"
|
||||
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion","CurrentVersion",0x00020000,"5.0"
|
||||
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion","CSDVersion",0x00020000,"Service Pack 3"
|
||||
HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion","CurrentBuildNumber",0x00020000,"2195"
|
||||
|
||||
|
||||
; Image File Execution Options (NtGlobalFlag with FLG_SHOW_LDR_SNAPS set for loadlib.exe)
|
||||
|
@@ -64,10 +64,14 @@ HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\00010409","Layout File",0
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\00010409","Layout Text",0x00000000,"US-Dvorak"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\0000040c","Layout File",0x00000000,"kbdfr.dll"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\0000040c","Layout Text",0x00000000,"FR"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\00000419","Layout File",0x00000000,"kbdru.dll"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\00000419","Layout Text",0x00000000,"Russian"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\0000041d","Layout File",0x00000000,"kbdse.dll"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\0000041d","Layout Text",0x00000000,"SE"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\00000809","Layout File",0x00000000,"kbduk.dll"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\00000809","Layout Text",0x00000000,"UK"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\00000807","Layout File",0x00000000,"kbdsg.dll"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\00000807","Layout Text",0x00000000,"SG"
|
||||
|
||||
; Network
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}",,0x00000000,"Network Adapters"
|
||||
@@ -168,6 +172,7 @@ HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","040f",0x00000000,"l_intl.n
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0410",0x00000000,"l_intl.nls"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","041d",0x00000000,"l_intl.nls"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0809",0x00000000,"l_intl.nls"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0807",0x00000000,"l_intl.nls"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","Default",0x00000000,"0409"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","InstallLanguage",0x00000000,"0409"
|
||||
|
||||
@@ -288,9 +293,9 @@ HKLM,"SYSTEM\CurrentControlSet\Services\3c90x1\Linkage","Export",0x00010000,"\De
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\3c90x1\Linkage","Route",0x00010000,"3c90x1"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\3c90x1\Parameters","SlotNumber",0x00000000,"10"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\3c90x1\Parameters","BusNumber",0x00000000,"0"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\3c90x1\Parameters\Tcpip","DefaultGateway",0x00010000,"10.0.0.1"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\3c90x1\Parameters\Tcpip","IPAddress",0x00010000,"10.0.0.100"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\3c90x1\Parameters\Tcpip","SubnetMask",0x00010000,"255.255.255.0"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\3c90x1\Parameters\Tcpip","DefaultGateway",0x00010000,"0.0.0.0"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\3c90x1\Parameters\Tcpip","IPAddress",0x00010000,"0.0.0.0"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\3c90x1\Parameters\Tcpip","SubnetMask",0x00010000,"0.0.0.0"
|
||||
|
||||
; Afd driver
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Afd","ErrorControl",0x00010001,0x00000001
|
||||
@@ -441,6 +446,13 @@ HKLM,"SYSTEM\CurrentControlSet\Services\EventLog","ImagePath",0x00020000,"%Syste
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\EventLog","Start",0x00010001,0x00000002
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\EventLog","Type",0x00010001,0x00000010
|
||||
|
||||
; DHCP client service
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\DHCP","ErrorControl",0x00010001,0x00000000
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\DHCP","Group",0x00000000,"Network"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\DHCP","ImagePath",0x00020000,"%SystemRoot%\system32\dhcp.exe"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\DHCP","Start",0x00010001,0x00000002
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\DHCP","Type",0x00010001,0x00000010
|
||||
|
||||
; Floppy driver
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Floppy","ErrorControl",0x00010001,0x00000000
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Floppy","Group",0x00000000,"Primary Disk"
|
||||
@@ -469,6 +481,19 @@ HKLM,"SYSTEM\CurrentControlSet\Services\Keyboard","ImagePath",0x00020000,"system
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Keyboard","Start",0x00010001,0x00000001
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Keyboard","Type",0x00010001,0x00000001
|
||||
|
||||
; Serial port enumerator
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\serenum","ErrorControl",0x00010001,0x00000001
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\serenum","Group",0x00000000,"PNP Filter"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\serenum","ImagePath",0x00020000,"system32\drivers\serenum.sys"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\serenum","Start",0x00010001,0x00000003
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\serenum","Type",0x00010001,0x00000001
|
||||
;hard coded values
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\serenum\Enum","0",0x00000000,"ACPI\PNP0501"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\serenum\Enum","Count",0x00010001,0x00000001
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\serenum\Enum","NextInstance",0x00010001,0x00000001
|
||||
HKLM,"SYSTEM\CurrentControlSet\Enum\ACPI\PNP0501\1","UpperFilters",0x00010000,"serenum"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Enum\ACPI\PNP0501\2","UpperFilters",0x00010000,"serenum"
|
||||
|
||||
; SB16 driver
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\sndblst","Group",0x00000000,"Base"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\sndblst","ServiceType",0x00010001,0x00000001
|
||||
@@ -554,9 +579,9 @@ HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE103
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\0001","Port",0x00000000,"280"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\0001","Irq",0x00000000,"9"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\0001","NetworkAddress",0x00000000,"001122334455"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters\Tcpip","DefaultGateway",0x00010000,"10.0.0.1"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters\Tcpip","IPAddress",0x00010000,"10.0.0.100"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters\Tcpip","SubnetMask",0x00010000,"255.255.255.0"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters\Tcpip","DefaultGateway",0x00010000,"0.0.0.0"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters\Tcpip","IPAddress",0x00010000,"0.0.0.0"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters\Tcpip","SubnetMask",0x00010000,"0.0.0.0"
|
||||
|
||||
; one day this will happen automatically; until then we need this since ndis5 drivers
|
||||
; rely on the fact that their resources are handed to them by ndis, so we have to find
|
||||
@@ -645,9 +670,9 @@ HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE103
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\0000","BusNumber",0x00000000,"0"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\{RANDOMCFGGUIDFOR_PCNET1}",,0x00000000,"Network Adapters"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\{RANDOMCFGGUIDFOR_PCNET1}\Connection","Name",0x00000000,"AMD PCNet (static Registry entry)"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters\Tcpip","DefaultGateway",0x00010000,"10.0.0.1"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters\Tcpip","IPAddress",0x00010000,"10.0.0.100"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters\Tcpip","SubnetMask",0x00010000,"255.255.255.0"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters\Tcpip","DefaultGateway",0x00010000,"0.0.0.0"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters\Tcpip","IPAddress",0x00010000,"0.0.0.0"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters\Tcpip","SubnetMask",0x00010000,"0.0.0.0"
|
||||
|
||||
; Named Pipe filesystem driver
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Npfs","ErrorControl",0x00010001,0x00000000
|
||||
@@ -674,13 +699,14 @@ HKLM,"SYSTEM\CurrentControlSet\Services\Null","Type",0x00010001,0x00000001
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Serial","ErrorControl",0x00010001,0x00000000
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Serial","Group",0x00000000,"Base"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Serial","ImagePath",0x00020000,"system32\drivers\serial.sys"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Serial","Start",0x00010001,0x00000004
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Serial","Start",0x00010001,0x00000001
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Serial","Type",0x00010001,0x00000001
|
||||
;hard coded values
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Serial\Enum","0",0x00000000,"ACPI\PNP0501"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Serial\Enum","Count",0x00010001,0x00000001
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Serial\Enum","NextInstance",0x00010001,0x00000001
|
||||
HKLM,"SYSTEM\CurrentControlSet\Enum\ACPI\PNP0501\0000","Service",0x00000000,"serial"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Enum\ACPI\PNP0501\1","Service",0x00000000,"serial"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Enum\ACPI\PNP0501\2","Service",0x00000000,"serial"
|
||||
|
||||
; Packet driver
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Packet","ErrorControl",0x00010001,0x00000001
|
||||
@@ -780,6 +806,15 @@ HKLM,"SYSTEM\CurrentControlSet\Services\Vfatfs","ImagePath",0x00020000,"system32
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Vfatfs","Start",0x00010001,0x00000000
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Vfatfs","Type",0x00010001,0x00000002
|
||||
|
||||
; Xbox Nvidia driver
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\XboxVmp","ErrorControl",0x00010001,0x00000000
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\XboxVmp","Group",0x00000000,"Video"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\XboxVmp","ImagePath",0x00020000,"system32\drivers\xboxvmp.sys"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\XboxVmp","Start",0x00010001,0x00000001
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\XboxVmp","Type",0x00010001,0x00000001
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\XboxVmp\Device0","InstalledDisplayDrivers",0x00010000,"framebuf"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Enum\PCI\VEN_10DE&DEV_02A0&SUBSYS_00000000&REV_A1\0000","Service",0x00000000,"XboxVmp"
|
||||
|
||||
; VBE SVGA driver
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\VBE","ErrorControl",0x00010001,0x00000000
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\VBE","Group",0x00000000,"Video Save SVGA"
|
||||
@@ -839,100 +874,4 @@ HKLM,"SYSTEM\Setup","OsLoaderPath",0x00000000,"\"
|
||||
HKLM,"SYSTEM\Setup","SetupType",0x00010001,0x00000001
|
||||
HKLM,"SYSTEM\Setup","SystemPartition",0x00000000,"\Device\Harddisk0\Partition1"
|
||||
HKLM,"SYSTEM\Setup","SystemSetupInProgress",0x00010001,0x00000000
|
||||
|
||||
; ----------------------------- KJS Init ----------------------------
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","kjsinit",0x00010000,\
|
||||
"function init(v) { var rk = '\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Kdb'; eval(System.regread(rk,v)); } for( i = 1; i <= 45; i++ ) { init((new Number(i)).toString()); }"
|
||||
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","1",0x00010000,\
|
||||
"function write(x) { System.print(x); }"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","2",0x00010000,\
|
||||
"function regs(n) { return System.regs(n); }"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","3",0x00010000,\
|
||||
"function debugebp() { return regs(0); }"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","4",0x00010000,\
|
||||
"function debugeip() { return regs(1); }"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","5",0x00010000,\
|
||||
"function tf_argmark() { return regs(2); }"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","6",0x00010000,\
|
||||
"function tf_pointer() { return regs(3); }"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","7",0x00010000,\
|
||||
"function tf_tempcs() { return regs(4); } "
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","8",0x00010000,\
|
||||
"function tf_tempeip() { return regs(5); } "
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","9",0x00010000,\
|
||||
"function dr0() { return regs(6); } "
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","10",0x00010000,\
|
||||
"function dr1() { return regs(7); } "
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","11",0x00010000,\
|
||||
"function dr2() { return regs(8); } "
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","12",0x00010000,\
|
||||
"function dr3() { return regs(9); } "
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","13",0x00010000,\
|
||||
"function dr6() { return regs(10); } "
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","14",0x00010000,\
|
||||
"function dr7() { return regs(11); } "
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","15",0x00010000,\
|
||||
"function gs() { return regs(12) & 0xffff; }"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","16",0x00010000,\
|
||||
"function es() { return regs(13) & 0xffff; }"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","17",0x00010000,\
|
||||
"function ds() { return regs(14) & 0xffff; }"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","18",0x00010000,\
|
||||
"function edx() { return regs(15); }"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","19",0x00010000,\
|
||||
"function ecx() { return regs(16); }"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","20",0x00010000,\
|
||||
"function eax() { return regs(17); }"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","21",0x00010000,\
|
||||
"function tf_pmode() { return regs(18); }"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","22",0x00010000,\
|
||||
"function tf_exl() { return regs(19); }"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","23",0x00010000,\
|
||||
"function fs() { return regs(20) & 0xffff; }"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","24",0x00010000,\
|
||||
"function edi() { return regs(21); }"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","25",0x00010000,\
|
||||
"function esi() { return regs(22); }"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","26",0x00010000,\
|
||||
"function ebx() { return regs(23); }"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","27",0x00010000,\
|
||||
"function ebp() { return regs(24); }"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","28",0x00010000,\
|
||||
"function error_code() { return regs(25); }"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","29",0x00010000,\
|
||||
"function eip() { return regs(26); }"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","30",0x00010000,\
|
||||
"function cs() { return regs(27) & 0xffff; }"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","31",0x00010000,\
|
||||
"function eflags() { return regs(28); }"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","32",0x00010000,\
|
||||
"function esp() { return regs(29); }"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","33",0x00010000,\
|
||||
"function ss() { return regs(30) & 0xffff; }"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","34",0x00010000,\
|
||||
"function v86_es() { return regs(31) & 0xffff; }"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","35",0x00010000,\
|
||||
"function v86_ds() { return regs(32) & 0xffff; }"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","36",0x00010000,\
|
||||
"function v86_fs() { return regs(33) & 0xffff; }"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","37",0x00010000,\
|
||||
"function v86_gs() { return regs(34) & 0xffff; }"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","38",0x00010000,\
|
||||
"function peekl(a) { return System.mread(4,a); }"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","39",0x00010000,\
|
||||
"function pokel(a,b) { return System.mwrite(4,a,b); }"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","40",0x00010000,\
|
||||
"function peekw(a) { return System.mread(2,a); }"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","41",0x00010000,\
|
||||
"function pokew(a,b) { return System.mwrite(2,a,b); }"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","42",0x00010000,\
|
||||
"function peek(a) { return System.mread(1,a); }"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","43",0x00010000,\
|
||||
"function poke(a,b) { return System.mwrite(1,a,b); }"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","44",0x00010000,\
|
||||
"function regread(x,y) { return System.regread(x,y); }"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Kdb","45",0x00010000,\
|
||||
"write('JS Registry Init Complete. Welcome to ReactOS kernel scripting');"
|
||||
|
||||
; EOF
|
||||
|
@@ -29,6 +29,7 @@ Signature = "$ReactOS$"
|
||||
drivers\bus\acpi\acpi.sys 2
|
||||
drivers\bus\isapnp\isapnp.sys 2
|
||||
drivers\bus\pci\pci.sys 2
|
||||
drivers\bus\serenum\serenum.sys 2
|
||||
drivers\dd\beep\beep.sys 2
|
||||
drivers\dd\bootvid\bootvid.sys 2
|
||||
drivers\dd\null\null.sys 2
|
||||
@@ -87,7 +88,9 @@ lib\kbddv\kbddv.dll 1
|
||||
lib\kbdes\kbdes.dll 1
|
||||
lib\kbdfr\kbdfr.dll 1
|
||||
lib\kbdgr\kbdgr.dll 1
|
||||
lib\kbdru\kbdru.dll 1
|
||||
lib\kbdse\kbdse.dll 1
|
||||
lib\kbdsg\kbdsg.dll 1
|
||||
lib\kbduk\kbduk.dll 1
|
||||
lib\kbdus\kbdus.dll 1
|
||||
lib\kernel32\kernel32.dll 1
|
||||
@@ -114,6 +117,7 @@ lib\richedit\riched32.dll 1
|
||||
lib\rpcrt4\rpcrt4.dll 1
|
||||
lib\samlib\samlib.dll 1
|
||||
lib\secur32\secur32.dll 1
|
||||
lib\serialui\serialui.dll 1
|
||||
lib\setupapi\setupapi.dll 1
|
||||
lib\shdocvw\shdocvw.dll 1
|
||||
lib\shell32\shell32.dll 1
|
||||
@@ -163,6 +167,7 @@ subsys\system\userinit\userinit.exe 1
|
||||
subsys\system\vmwinst\vmwinst.exe 1
|
||||
subsys\system\winlogon\winlogon.exe 1
|
||||
subsys\system\winefile\winefile.exe 1
|
||||
subsys\system\dhcp\dhcp.exe 1
|
||||
services\eventlog\eventlog.exe 1
|
||||
services\rpcss\rpcss.exe 1
|
||||
services\umpnpmgr\umpnpmgr.exe 1
|
||||
|
@@ -35,7 +35,7 @@ Cabinet=reactos.cab
|
||||
[SetupData]
|
||||
DefaultPath = \ReactOS
|
||||
OsLoadOptions = "/NOGUIBOOT /NODEBUG"
|
||||
;OsLoadOptions = "/NOGUIBOOT /DEBUGPORT=COM1"
|
||||
;OsLoadOptions = "/NOGUIBOOT /DEBUGPORT=COM1 /BAUDRATE=19200 /IRQ=4"
|
||||
;OsLoadOptions = "/NOGUIBOOT /DEBUGPORT=SCREEN"
|
||||
;OsLoadOptions = "/NOGUIBOOT /DEBUGPORT=BOCHS"
|
||||
|
||||
@@ -77,18 +77,22 @@ Default = "XT-, AT- or extended keyboard (83-105 keys)"
|
||||
00010409 = "English (USA-Dvorak)"
|
||||
0000040C = "French (France)"
|
||||
00000407 = "German (Germany)"
|
||||
00000419 = "Russian"
|
||||
0000040A = "Spanish (traditional short)"
|
||||
0000041D = "Swedish (Sweden)"
|
||||
00000807 = "German (Swiss)"
|
||||
|
||||
[Files.KeyboardLayout]
|
||||
00000406 = kbdda.dll
|
||||
00000407 = kbdgr.dll
|
||||
00000409 = kbdus.dll
|
||||
00010409 = kbddv.dll
|
||||
0000040C = kbdfr.dll
|
||||
0000041D = kbdse.dll
|
||||
00000809 = kgbgb.dll
|
||||
0000040A = kbdes.dll
|
||||
0000040C = kbdfr.dll
|
||||
00000419 = kbdru.dll
|
||||
0000041D = kbdse.dll
|
||||
00000809 = kbduk.dll
|
||||
00000807 = kbdsg.dll
|
||||
|
||||
[Mouse]
|
||||
;<id> = <user friendly name>,<spare>,<service key name>
|
||||
|
@@ -6,7 +6,7 @@ PATH_TO_TOP = ../..
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
DRIVERS = acpi isapnp pci
|
||||
DRIVERS = acpi isapnp pci serenum
|
||||
|
||||
all: $(DRIVERS)
|
||||
|
||||
|
@@ -4,6 +4,7 @@
|
||||
* FILE: acpi/ospm/fdo.c
|
||||
* PURPOSE: ACPI device object dispatch routines
|
||||
* PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
|
||||
* Herv<72> Poussineau (hpoussin@reactos.com)
|
||||
* UPDATE HISTORY:
|
||||
* 08-08-2001 CSH Created
|
||||
*/
|
||||
@@ -115,6 +116,149 @@ AcpiCreateInstanceIDString(PUNICODE_STRING InstanceID,
|
||||
}
|
||||
|
||||
|
||||
static BOOLEAN
|
||||
AcpiCreateResourceList(PCM_RESOURCE_LIST* pResourceList,
|
||||
PULONG ResourceListSize,
|
||||
RESOURCE* resources)
|
||||
{
|
||||
BOOLEAN Done;
|
||||
ULONG NumberOfResources = 0;
|
||||
PCM_RESOURCE_LIST ResourceList;
|
||||
PCM_PARTIAL_RESOURCE_DESCRIPTOR ResourceDescriptor;
|
||||
RESOURCE* resource;
|
||||
ULONG i;
|
||||
KIRQL Dirql;
|
||||
|
||||
/* Count number of resources */
|
||||
Done = FALSE;
|
||||
resource = resources;
|
||||
while (!Done)
|
||||
{
|
||||
switch (resource->id)
|
||||
{
|
||||
case irq:
|
||||
{
|
||||
IRQ_RESOURCE *irq_data = (IRQ_RESOURCE*) &resource->data;
|
||||
NumberOfResources += irq_data->number_of_interrupts;
|
||||
break;
|
||||
}
|
||||
case dma:
|
||||
{
|
||||
DMA_RESOURCE *dma_data = (DMA_RESOURCE*) &resource->data;
|
||||
NumberOfResources += dma_data->number_of_channels;
|
||||
break;
|
||||
}
|
||||
case io:
|
||||
{
|
||||
NumberOfResources++;
|
||||
break;
|
||||
}
|
||||
case end_tag:
|
||||
{
|
||||
Done = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
resource = (RESOURCE *) ((NATIVE_UINT) resource + (NATIVE_UINT) resource->length);
|
||||
}
|
||||
|
||||
/* Allocate memory */
|
||||
*ResourceListSize = sizeof(CM_RESOURCE_LIST) + sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR) * (NumberOfResources - 1);
|
||||
ResourceList = (PCM_RESOURCE_LIST)ExAllocatePool(PagedPool, *ResourceListSize);
|
||||
*pResourceList = ResourceList;
|
||||
if (!ResourceList)
|
||||
return FALSE;
|
||||
ResourceList->Count = 1;
|
||||
ResourceList->List[0].InterfaceType = Internal; /* FIXME */
|
||||
ResourceList->List[0].BusNumber = 0; /* We're the only ACPI bus device in the system */
|
||||
ResourceList->List[0].PartialResourceList.Version = 1;
|
||||
ResourceList->List[0].PartialResourceList.Revision = 1;
|
||||
ResourceList->List[0].PartialResourceList.Count = NumberOfResources;
|
||||
ResourceDescriptor = ResourceList->List[0].PartialResourceList.PartialDescriptors;
|
||||
|
||||
/* Fill resources list structure */
|
||||
Done = FALSE;
|
||||
resource = resources;
|
||||
while (!Done)
|
||||
{
|
||||
switch (resource->id)
|
||||
{
|
||||
case irq:
|
||||
{
|
||||
IRQ_RESOURCE *irq_data = (IRQ_RESOURCE*) &resource->data;
|
||||
for (i = 0; i < irq_data->number_of_interrupts; i++)
|
||||
{
|
||||
ResourceDescriptor->Type = CmResourceTypeInterrupt;
|
||||
|
||||
ResourceDescriptor->ShareDisposition =
|
||||
(irq_data->shared_exclusive == SHARED ? CmResourceShareShared : CmResourceShareDeviceExclusive);
|
||||
ResourceDescriptor->Flags =
|
||||
(irq_data->edge_level == LEVEL_SENSITIVE ? CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE : CM_RESOURCE_INTERRUPT_LATCHED);
|
||||
ResourceDescriptor->u.Interrupt.Vector = HalGetInterruptVector(
|
||||
Internal, 0, 0, irq_data->interrupts[i],
|
||||
&Dirql,
|
||||
&ResourceDescriptor->u.Interrupt.Affinity);
|
||||
ResourceDescriptor->u.Interrupt.Level = (ULONG)Dirql;
|
||||
ResourceDescriptor++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case dma:
|
||||
{
|
||||
DMA_RESOURCE *dma_data = (DMA_RESOURCE*) &resource->data;
|
||||
for (i = 0; i < dma_data->number_of_channels; i++)
|
||||
{
|
||||
ResourceDescriptor->Type = CmResourceTypeDma;
|
||||
ResourceDescriptor->Flags = 0;
|
||||
switch (dma_data->type)
|
||||
{
|
||||
case TYPE_A: ResourceDescriptor->Flags |= CM_RESOURCE_DMA_TYPE_A; break;
|
||||
case TYPE_B: ResourceDescriptor->Flags |= CM_RESOURCE_DMA_TYPE_B; break;
|
||||
case TYPE_F: ResourceDescriptor->Flags |= CM_RESOURCE_DMA_TYPE_F; break;
|
||||
}
|
||||
if (dma_data->bus_master == BUS_MASTER)
|
||||
ResourceDescriptor->Flags |= CM_RESOURCE_DMA_BUS_MASTER;
|
||||
switch (dma_data->transfer)
|
||||
{
|
||||
case TRANSFER_8: ResourceDescriptor->Flags |= CM_RESOURCE_DMA_8; break;
|
||||
case TRANSFER_16: ResourceDescriptor->Flags |= CM_RESOURCE_DMA_16; break;
|
||||
case TRANSFER_8_16: ResourceDescriptor->Flags |= CM_RESOURCE_DMA_8_AND_16; break;
|
||||
}
|
||||
ResourceDescriptor->u.Dma.Channel = dma_data->channels[i];
|
||||
ResourceDescriptor++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case io:
|
||||
{
|
||||
IO_RESOURCE *io_data = (IO_RESOURCE*) &resource->data;
|
||||
ResourceDescriptor->Type = CmResourceTypePort;
|
||||
ResourceDescriptor->ShareDisposition = CmResourceShareDriverExclusive;
|
||||
ResourceDescriptor->Flags = CM_RESOURCE_PORT_IO;
|
||||
if (io_data->io_decode == DECODE_16)
|
||||
ResourceDescriptor->Flags |= CM_RESOURCE_PORT_16_BIT_DECODE;
|
||||
else
|
||||
ResourceDescriptor->Flags |= CM_RESOURCE_PORT_10_BIT_DECODE;
|
||||
ResourceDescriptor->u.Port.Start.u.HighPart = 0;
|
||||
ResourceDescriptor->u.Port.Start.u.LowPart = io_data->min_base_address;
|
||||
ResourceDescriptor->u.Port.Length = io_data->range_length;
|
||||
ResourceDescriptor++;
|
||||
break;
|
||||
}
|
||||
case end_tag:
|
||||
{
|
||||
Done = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
resource = (RESOURCE *) ((NATIVE_UINT) resource + (NATIVE_UINT) resource->length);
|
||||
}
|
||||
|
||||
acpi_rs_dump_resource_list(resource);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static NTSTATUS
|
||||
FdoQueryBusRelations(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
@@ -149,6 +293,7 @@ FdoQueryBusRelations(
|
||||
CurrentEntry = DeviceExtension->DeviceListHead.Flink;
|
||||
while (CurrentEntry != &DeviceExtension->DeviceListHead)
|
||||
{
|
||||
ACPI_BUFFER Buffer;
|
||||
Device = CONTAINING_RECORD(CurrentEntry, ACPI_DEVICE, DeviceListEntry);
|
||||
|
||||
/* FIXME: For ACPI namespace devices on the motherboard create filter DOs
|
||||
@@ -200,6 +345,34 @@ FdoQueryBusRelations(
|
||||
AcpiStatus = bm_get_node(Device->BmHandle, 0, &Node);
|
||||
if (ACPI_SUCCESS(AcpiStatus))
|
||||
{
|
||||
/* Get current resources */
|
||||
Buffer.length = 0;
|
||||
Status = acpi_get_current_resources(Node->device.acpi_handle, &Buffer);
|
||||
if ((Status & ACPI_OK) == 0)
|
||||
{
|
||||
ASSERT(FALSE);
|
||||
}
|
||||
if (Buffer.length > 0)
|
||||
{
|
||||
Buffer.pointer = ExAllocatePool(PagedPool, Buffer.length);
|
||||
if (!Buffer.pointer)
|
||||
{
|
||||
ASSERT(FALSE);
|
||||
}
|
||||
Status = acpi_get_current_resources(Node->device.acpi_handle, &Buffer);
|
||||
if (ACPI_FAILURE(Status))
|
||||
{
|
||||
ASSERT(FALSE);
|
||||
}
|
||||
if (!AcpiCreateResourceList(&PdoDeviceExtension->ResourceList,
|
||||
&PdoDeviceExtension->ResourceListSize,
|
||||
(RESOURCE*)Buffer.pointer))
|
||||
{
|
||||
ASSERT(FALSE);
|
||||
}
|
||||
ExFreePool(Buffer.pointer);
|
||||
}
|
||||
|
||||
/* Add Device ID string */
|
||||
if (!AcpiCreateDeviceIDString(&PdoDeviceExtension->DeviceID,
|
||||
Node))
|
||||
|
@@ -47,6 +47,9 @@ typedef struct _PDO_DEVICE_EXTENSION
|
||||
UNICODE_STRING InstanceID;
|
||||
// Hardware IDs
|
||||
UNICODE_STRING HardwareIDs;
|
||||
// Resource list
|
||||
PCM_RESOURCE_LIST ResourceList;
|
||||
ULONG ResourceListSize;
|
||||
} PDO_DEVICE_EXTENSION, *PPDO_DEVICE_EXTENSION;
|
||||
|
||||
|
||||
|
@@ -107,6 +107,35 @@ PdoQueryId(
|
||||
}
|
||||
|
||||
|
||||
static NTSTATUS
|
||||
PdoQueryResources(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp,
|
||||
PIO_STACK_LOCATION IrpSp)
|
||||
{
|
||||
PPDO_DEVICE_EXTENSION DeviceExtension;
|
||||
PCM_RESOURCE_LIST ResourceList;
|
||||
|
||||
DeviceExtension = (PPDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
|
||||
if (DeviceExtension->ResourceListSize == 0)
|
||||
{
|
||||
return Irp->IoStatus.Status;
|
||||
}
|
||||
|
||||
ResourceList = ExAllocatePool(PagedPool, DeviceExtension->ResourceListSize);
|
||||
if (!ResourceList)
|
||||
{
|
||||
Irp->IoStatus.Information = 0;
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
RtlCopyMemory(ResourceList, DeviceExtension->ResourceList, DeviceExtension->ResourceListSize);
|
||||
Irp->IoStatus.Information = (ULONG_PTR)ResourceList;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static NTSTATUS
|
||||
PdoSetPower(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
@@ -201,6 +230,9 @@ PdoPnpControl(
|
||||
break;
|
||||
|
||||
case IRP_MN_QUERY_RESOURCES:
|
||||
Status = PdoQueryResources(DeviceObject,
|
||||
Irp,
|
||||
IrpSp);
|
||||
break;
|
||||
|
||||
case IRP_MN_QUERY_STOP_DEVICE:
|
||||
@@ -213,6 +245,7 @@ PdoPnpControl(
|
||||
break;
|
||||
|
||||
case IRP_MN_START_DEVICE:
|
||||
Status = STATUS_SUCCESS;
|
||||
break;
|
||||
|
||||
case IRP_MN_STOP_DEVICE:
|
||||
|
541
reactos/drivers/bus/serenum/detect.c
Normal file
541
reactos/drivers/bus/serenum/detect.c
Normal file
@@ -0,0 +1,541 @@
|
||||
/* $Id:
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS Serial enumerator driver
|
||||
* FILE: drivers/bus/serenum/detect.c
|
||||
* PURPOSE: Detection of serial devices
|
||||
*
|
||||
* PROGRAMMERS: Jason Filby (jasonfilby@yahoo.com)
|
||||
* Filip Navara (xnavara@volny.cz)
|
||||
* Herv<72> Poussineau (hpoussin@reactos.com)
|
||||
*/
|
||||
|
||||
#define NDEBUG
|
||||
#include "serenum.h"
|
||||
|
||||
static NTSTATUS
|
||||
SerenumDeviceIoControl(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN ULONG CtlCode,
|
||||
IN PVOID InputBuffer OPTIONAL,
|
||||
IN ULONG InputBufferSize,
|
||||
IN OUT PVOID OutputBuffer OPTIONAL,
|
||||
IN OUT PULONG OutputBufferSize)
|
||||
{
|
||||
KEVENT Event;
|
||||
PIRP Irp;
|
||||
IO_STATUS_BLOCK IoStatus;
|
||||
NTSTATUS Status;
|
||||
|
||||
KeInitializeEvent (&Event, NotificationEvent, FALSE);
|
||||
|
||||
Irp = IoBuildDeviceIoControlRequest(CtlCode,
|
||||
DeviceObject,
|
||||
InputBuffer,
|
||||
InputBufferSize,
|
||||
OutputBuffer,
|
||||
(OutputBufferSize) ? *OutputBufferSize : 0,
|
||||
FALSE,
|
||||
&Event,
|
||||
&IoStatus);
|
||||
if (Irp == NULL)
|
||||
{
|
||||
DPRINT("Serenum: IoBuildDeviceIoControlRequest() failed\n");
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
Status = IoCallDriver(DeviceObject, Irp);
|
||||
|
||||
if (Status == STATUS_PENDING)
|
||||
{
|
||||
DPRINT("Serenum: Operation pending\n");
|
||||
KeWaitForSingleObject(&Event, Suspended, KernelMode, FALSE, NULL);
|
||||
Status = IoStatus.Status;
|
||||
}
|
||||
|
||||
if (OutputBufferSize)
|
||||
{
|
||||
*OutputBufferSize = IoStatus.Information;
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
static NTSTATUS
|
||||
ReadBytes(
|
||||
IN PDEVICE_OBJECT LowerDevice,
|
||||
OUT PUCHAR Buffer,
|
||||
IN ULONG BufferSize,
|
||||
OUT PULONG FilledBytes)
|
||||
{
|
||||
PIRP Irp;
|
||||
IO_STATUS_BLOCK ioStatus;
|
||||
KEVENT event;
|
||||
NTSTATUS Status;
|
||||
|
||||
KeInitializeEvent(&event, NotificationEvent, FALSE);
|
||||
Irp = IoBuildSynchronousFsdRequest(
|
||||
IRP_MJ_READ,
|
||||
LowerDevice,
|
||||
Buffer, BufferSize,
|
||||
0,
|
||||
&event,
|
||||
&ioStatus);
|
||||
if (!Irp)
|
||||
return FALSE;
|
||||
|
||||
Status = IoCallDriver(LowerDevice, Irp);
|
||||
if (Status == STATUS_PENDING)
|
||||
{
|
||||
KeWaitForSingleObject(&event, Suspended, KernelMode, FALSE, NULL);
|
||||
Status = ioStatus.Status;
|
||||
}
|
||||
DPRINT("Serenum: bytes received: %lu/%lu\n",
|
||||
ioStatus.Information, BufferSize);
|
||||
*FilledBytes = ioStatus.Information;
|
||||
return Status;
|
||||
}
|
||||
|
||||
static NTSTATUS
|
||||
ReportDetectedDevice(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PUNICODE_STRING DeviceDescription,
|
||||
IN PUNICODE_STRING DeviceId,
|
||||
IN PUNICODE_STRING HardwareIds,
|
||||
IN PUNICODE_STRING CompatibleIds)
|
||||
{
|
||||
PDEVICE_OBJECT Pdo = NULL;
|
||||
PPDO_DEVICE_EXTENSION PdoDeviceExtension = NULL;
|
||||
PFDO_DEVICE_EXTENSION FdoDeviceExtension;
|
||||
NTSTATUS Status;
|
||||
|
||||
DPRINT("Serenum: SerenumReportDetectedDevice() called with %wZ (%wZ) detected\n", DeviceId, DeviceDescription);
|
||||
|
||||
Status = IoCreateDevice(
|
||||
DeviceObject->DriverObject,
|
||||
sizeof(PDO_DEVICE_EXTENSION),
|
||||
NULL,
|
||||
FILE_DEVICE_CONTROLLER,
|
||||
FILE_AUTOGENERATED_DEVICE_NAME,
|
||||
FALSE,
|
||||
&Pdo);
|
||||
if (!NT_SUCCESS(Status)) goto ByeBye;
|
||||
|
||||
Pdo->Flags |= DO_BUS_ENUMERATED_DEVICE;
|
||||
Pdo->Flags |= DO_POWER_PAGABLE;
|
||||
PdoDeviceExtension = (PPDO_DEVICE_EXTENSION)Pdo->DeviceExtension;
|
||||
FdoDeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
RtlZeroMemory(PdoDeviceExtension, sizeof(PDO_DEVICE_EXTENSION));
|
||||
PdoDeviceExtension->Common.IsFDO = FALSE;
|
||||
Status = SerenumDuplicateUnicodeString(&PdoDeviceExtension->DeviceDescription, DeviceDescription, PagedPool);
|
||||
if (!NT_SUCCESS(Status)) goto ByeBye;
|
||||
Status = SerenumDuplicateUnicodeString(&PdoDeviceExtension->DeviceId, DeviceId, PagedPool);
|
||||
if (!NT_SUCCESS(Status)) goto ByeBye;
|
||||
Status = SerenumDuplicateUnicodeString(&PdoDeviceExtension->HardwareIds, HardwareIds, PagedPool);
|
||||
if (!NT_SUCCESS(Status)) goto ByeBye;
|
||||
Status = SerenumDuplicateUnicodeString(&PdoDeviceExtension->CompatibleIds, CompatibleIds, PagedPool);
|
||||
if (!NT_SUCCESS(Status)) goto ByeBye;
|
||||
|
||||
/* Device attached to serial port (Pdo) may delegate work to
|
||||
* serial port stack (Fdo = DeviceObject variable) */
|
||||
Pdo->StackSize = DeviceObject->StackSize + 1;
|
||||
|
||||
FdoDeviceExtension->AttachedPdo = Pdo;
|
||||
PdoDeviceExtension->AttachedFdo = DeviceObject;
|
||||
|
||||
Pdo->Flags |= DO_BUFFERED_IO;
|
||||
Pdo->Flags &= ~DO_DEVICE_INITIALIZING;
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
|
||||
ByeBye:
|
||||
if (Pdo)
|
||||
{
|
||||
if (PdoDeviceExtension->DeviceDescription.Buffer)
|
||||
RtlFreeUnicodeString(&PdoDeviceExtension->DeviceDescription);
|
||||
if (PdoDeviceExtension->DeviceId.Buffer)
|
||||
RtlFreeUnicodeString(&PdoDeviceExtension->DeviceId);
|
||||
if (PdoDeviceExtension->HardwareIds.Buffer)
|
||||
RtlFreeUnicodeString(&PdoDeviceExtension->HardwareIds);
|
||||
if (PdoDeviceExtension->CompatibleIds.Buffer)
|
||||
RtlFreeUnicodeString(&PdoDeviceExtension->CompatibleIds);
|
||||
IoDeleteDevice(Pdo);
|
||||
}
|
||||
return Status;
|
||||
}
|
||||
|
||||
static BOOLEAN
|
||||
SerenumIsValidPnpIdString(
|
||||
IN PUCHAR Buffer,
|
||||
IN ULONG BufferLength)
|
||||
{
|
||||
/* FIXME: SerenumIsValidPnpIdString not implemented */
|
||||
DPRINT1("Serenum: SerenumIsValidPnpIdString() unimplemented\n");
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static NTSTATUS
|
||||
ReportDetectedPnpDevice(
|
||||
IN PUCHAR Buffer,
|
||||
IN ULONG BufferLength)
|
||||
{
|
||||
ULONG i;
|
||||
/* FIXME: ReportDetectedPnpDevice not implemented */
|
||||
DPRINT1("Serenum: ReportDetectedPnpDevice() unimplemented\n");
|
||||
DPRINT1("");
|
||||
for (i = 0; i < BufferLength; i++)
|
||||
DbgPrint("%c", Buffer[i]);
|
||||
DbgPrint("\n");
|
||||
/* Call ReportDetectedDevice */
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
#define BEGIN_ID '('
|
||||
#define END_ID ')'
|
||||
|
||||
static NTSTATUS
|
||||
SerenumWait(ULONG milliseconds)
|
||||
{
|
||||
KTIMER Timer;
|
||||
LARGE_INTEGER DueTime;
|
||||
|
||||
DueTime.QuadPart = milliseconds * -10;
|
||||
KeInitializeTimer(&Timer);
|
||||
KeSetTimer(&Timer, DueTime, NULL);
|
||||
return KeWaitForSingleObject(&Timer, Executive, KernelMode, FALSE, NULL);
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
SerenumDetectPnpDevice(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PDEVICE_OBJECT LowerDevice)
|
||||
{
|
||||
UCHAR Buffer[256];
|
||||
ULONG BaudRate;
|
||||
ULONG TotalBytesReceived = 0;
|
||||
ULONG Size;
|
||||
ULONG Msr, Purge;
|
||||
ULONG i;
|
||||
BOOLEAN BufferContainsBeginId = FALSE;
|
||||
BOOLEAN BufferContainsEndId = FALSE;
|
||||
SERIAL_LINE_CONTROL Lcr;
|
||||
SERIAL_TIMEOUTS Timeouts;
|
||||
SERIALPERF_STATS PerfStats;
|
||||
NTSTATUS Status;
|
||||
|
||||
/* 1. COM port initialization, check for device enumerate */
|
||||
CHECKPOINT;
|
||||
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_DTR,
|
||||
NULL, 0, NULL, NULL);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_RTS,
|
||||
NULL, 0, NULL, NULL);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
SerenumWait(200);
|
||||
Size = sizeof(Msr);
|
||||
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_GET_MODEMSTATUS,
|
||||
NULL, 0, &Msr, &Size);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
if ((Msr & SR_MSR_DSR) == 0) goto SerenumDisconnectIdle;
|
||||
|
||||
/* 2. COM port setup, 1st phase */
|
||||
CHECKPOINT;
|
||||
BaudRate = SERIAL_BAUD_1200;
|
||||
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_BAUD_RATE,
|
||||
&BaudRate, sizeof(BaudRate), NULL, 0);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
Lcr.WordLength = 7;
|
||||
Lcr.Parity = NO_PARITY;
|
||||
Lcr.StopBits = STOP_BIT_1;
|
||||
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_LINE_CONTROL,
|
||||
&Lcr, sizeof(Lcr), NULL, NULL);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_DTR,
|
||||
NULL, 0, NULL, NULL);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_RTS,
|
||||
NULL, 0, NULL, NULL);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
SerenumWait(200);
|
||||
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_DTR,
|
||||
NULL, 0, NULL, NULL);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
SerenumWait(200);
|
||||
|
||||
/* 3. Wait for response, 1st phase */
|
||||
CHECKPOINT;
|
||||
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_RTS,
|
||||
NULL, 0, NULL, NULL);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
Timeouts.ReadIntervalTimeout = 0;
|
||||
Timeouts.ReadTotalTimeoutMultiplier = 0;
|
||||
Timeouts.ReadTotalTimeoutConstant = 200;
|
||||
Timeouts.WriteTotalTimeoutMultiplier = Timeouts.WriteTotalTimeoutConstant = 0;
|
||||
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_TIMEOUTS,
|
||||
&Timeouts, sizeof(Timeouts), NULL, NULL);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
Status = ReadBytes(LowerDevice, Buffer, sizeof(Buffer), &Size);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
if (Size != 0) goto SerenumCollectPnpComDeviceId;
|
||||
|
||||
/* 4. COM port setup, 2nd phase */
|
||||
CHECKPOINT;
|
||||
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_DTR,
|
||||
NULL, 0, NULL, NULL);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_RTS,
|
||||
NULL, 0, NULL, NULL);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
Purge = SERIAL_PURGE_RXABORT | SERIAL_PURGE_RXCLEAR;
|
||||
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_PURGE,
|
||||
&Purge, 0, NULL, NULL);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
SerenumWait(200);
|
||||
|
||||
/* 5. Wait for response, 2nd phase */
|
||||
CHECKPOINT;
|
||||
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_DTR,
|
||||
NULL, 0, NULL, NULL);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_RTS,
|
||||
NULL, 0, NULL, NULL);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
Status = ReadBytes(LowerDevice, Buffer, 1, &TotalBytesReceived);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
if (TotalBytesReceived != 0) goto SerenumCollectPnpComDeviceId;
|
||||
Size = sizeof(Msr);
|
||||
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_GET_MODEMSTATUS,
|
||||
NULL, 0, &Msr, &Size);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
if ((Msr & SR_MSR_DSR) == 0) goto SerenumVerifyDisconnect; else goto SerenumConnectIdle;
|
||||
|
||||
/* 6. Collect PnP COM device ID */
|
||||
SerenumCollectPnpComDeviceId:
|
||||
CHECKPOINT;
|
||||
Timeouts.ReadIntervalTimeout = 200;
|
||||
Timeouts.ReadTotalTimeoutMultiplier = 0;
|
||||
Timeouts.ReadTotalTimeoutConstant = 2200;
|
||||
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_TIMEOUTS,
|
||||
&Timeouts, sizeof(Timeouts), NULL, NULL);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
Status = ReadBytes(LowerDevice, &Buffer[TotalBytesReceived], sizeof(Buffer) - TotalBytesReceived, &Size);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
TotalBytesReceived += Size;
|
||||
Size = sizeof(PerfStats);
|
||||
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_GET_STATS,
|
||||
NULL, 0, &PerfStats, &Size);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
if (PerfStats.FrameErrorCount + PerfStats.ParityErrorCount != 0) goto SerenumConnectIdle;
|
||||
for (i = 0; i < TotalBytesReceived; i++)
|
||||
{
|
||||
if (Buffer[i] == BEGIN_ID) BufferContainsBeginId = TRUE;
|
||||
if (Buffer[i] == END_ID) BufferContainsEndId = TRUE;
|
||||
}
|
||||
if (TotalBytesReceived == 1 || BufferContainsEndId)
|
||||
{
|
||||
if (SerenumIsValidPnpIdString(Buffer, TotalBytesReceived))
|
||||
return ReportDetectedPnpDevice(Buffer, TotalBytesReceived);
|
||||
goto SerenumConnectIdle;
|
||||
}
|
||||
if (!BufferContainsBeginId) goto SerenumConnectIdle;
|
||||
if (!BufferContainsEndId) goto SerenumConnectIdle;
|
||||
Size = sizeof(Msr);
|
||||
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_GET_MODEMSTATUS,
|
||||
NULL, 0, &Msr, &Size);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
if ((Msr & SR_MSR_DSR) == 0) goto SerenumVerifyDisconnect;
|
||||
|
||||
/* 7. Verify disconnect */
|
||||
SerenumVerifyDisconnect:
|
||||
CHECKPOINT;
|
||||
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_DTR,
|
||||
NULL, 0, NULL, NULL);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_RTS,
|
||||
NULL, 0, NULL, NULL);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
SerenumWait(5000);
|
||||
goto SerenumDisconnectIdle;
|
||||
|
||||
/* 8. Connect idle */
|
||||
SerenumConnectIdle:
|
||||
CHECKPOINT;
|
||||
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_DTR,
|
||||
NULL, 0, NULL, NULL);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_RTS,
|
||||
NULL, 0, NULL, NULL);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
BaudRate = SERIAL_BAUD_300;
|
||||
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_BAUD_RATE,
|
||||
&BaudRate, sizeof(BaudRate), NULL, NULL);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
Lcr.WordLength = 7;
|
||||
Lcr.Parity = NO_PARITY;
|
||||
Lcr.StopBits = STOP_BIT_1;
|
||||
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_LINE_CONTROL,
|
||||
&Lcr, sizeof(Lcr), NULL, NULL);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
if (TotalBytesReceived == 0)
|
||||
return STATUS_DEVICE_NOT_CONNECTED;
|
||||
else
|
||||
return STATUS_SUCCESS;
|
||||
|
||||
/* 9. Disconnect idle */
|
||||
SerenumDisconnectIdle:
|
||||
CHECKPOINT;
|
||||
/* FIXME: report to OS device removal, if it was present */
|
||||
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_DTR,
|
||||
NULL, 0, NULL, NULL);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_CLR_RTS,
|
||||
NULL, 0, NULL, NULL);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
BaudRate = SERIAL_BAUD_300;
|
||||
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_BAUD_RATE,
|
||||
&BaudRate, sizeof(BaudRate), NULL, NULL);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
Lcr.WordLength = 7;
|
||||
Lcr.Parity = NO_PARITY;
|
||||
Lcr.StopBits = STOP_BIT_1;
|
||||
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_LINE_CONTROL,
|
||||
&Lcr, sizeof(Lcr), NULL, NULL);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
return STATUS_DEVICE_NOT_CONNECTED;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
SerenumDetectLegacyDevice(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PDEVICE_OBJECT LowerDevice)
|
||||
{
|
||||
ULONG Fcr, Mcr;
|
||||
ULONG BaudRate;
|
||||
ULONG Command;
|
||||
SERIAL_TIMEOUTS Timeouts;
|
||||
SERIAL_LINE_CONTROL LCR;
|
||||
ULONG i, Count;
|
||||
UCHAR Buffer[16];
|
||||
UNICODE_STRING DeviceDescription;
|
||||
UNICODE_STRING DeviceId;
|
||||
UNICODE_STRING HardwareIds;
|
||||
UNICODE_STRING CompatibleIds;
|
||||
NTSTATUS Status;
|
||||
|
||||
RtlZeroMemory(Buffer, sizeof(Buffer));
|
||||
|
||||
/* Reset UART */
|
||||
CHECKPOINT;
|
||||
Mcr = 0; /* MCR: DTR/RTS/OUT2 off */
|
||||
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_MODEM_CONTROL,
|
||||
&Mcr, sizeof(Mcr), NULL, NULL);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
|
||||
/* Set communications parameters */
|
||||
CHECKPOINT;
|
||||
/* DLAB off */
|
||||
Fcr = 0;
|
||||
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_FIFO_CONTROL,
|
||||
&Fcr, sizeof(Fcr), NULL, NULL);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
/* Set serial port speed */
|
||||
BaudRate = SERIAL_BAUD_1200;
|
||||
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_BAUD_RATE,
|
||||
&BaudRate, sizeof(BaudRate), NULL, NULL);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
/* Set LCR */
|
||||
LCR.WordLength = 7;
|
||||
LCR.Parity = NO_PARITY;
|
||||
LCR.StopBits = STOP_BITS_2;
|
||||
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_LINE_CONTROL,
|
||||
&LCR, sizeof(LCR), NULL, NULL);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
|
||||
/* Flush receive buffer */
|
||||
CHECKPOINT;
|
||||
Command = SERIAL_PURGE_RXCLEAR;
|
||||
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_MODEM_CONTROL,
|
||||
&Command, sizeof(Command), NULL, NULL);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
/* Wait 100 ms */
|
||||
SerenumWait(100);
|
||||
|
||||
/* Enable DTR/RTS */
|
||||
CHECKPOINT;
|
||||
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_DTR,
|
||||
NULL, 0, NULL, NULL);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_RTS,
|
||||
NULL, 0, NULL, NULL);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
|
||||
/* Set timeout to 500 microseconds */
|
||||
CHECKPOINT;
|
||||
Timeouts.ReadIntervalTimeout = 100;
|
||||
Timeouts.ReadTotalTimeoutMultiplier = 0;
|
||||
Timeouts.ReadTotalTimeoutConstant = 500;
|
||||
Timeouts.WriteTotalTimeoutMultiplier = Timeouts.WriteTotalTimeoutConstant = 0;
|
||||
Status = SerenumDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_TIMEOUTS,
|
||||
&Timeouts, sizeof(Timeouts), NULL, NULL);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
|
||||
/* Fill the read buffer */
|
||||
CHECKPOINT;
|
||||
Status = ReadBytes(LowerDevice, Buffer, sizeof(Buffer)/sizeof(Buffer[0]), &Count);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
|
||||
for (i = 0; i < Count; i++)
|
||||
{
|
||||
if (Buffer[i] == 'B')
|
||||
{
|
||||
/* Sign for Microsoft Ballpoint */
|
||||
/* Hardware id: *PNP0F09
|
||||
* Compatible id: *PNP0F0F, SERIAL_MOUSE
|
||||
*/
|
||||
RtlInitUnicodeString(&DeviceDescription, L"Microsoft Ballpoint device");
|
||||
RtlInitUnicodeString(&DeviceId, L"*PNP0F09");
|
||||
SerenumInitMultiSzString(&HardwareIds, "*PNP0F09", NULL);
|
||||
SerenumInitMultiSzString(&CompatibleIds, "*PNP0F0F", "SERIAL_MOUSE", NULL);
|
||||
Status = ReportDetectedDevice(DeviceObject,
|
||||
&DeviceDescription, &DeviceId, &HardwareIds, &CompatibleIds);
|
||||
RtlFreeUnicodeString(&HardwareIds);
|
||||
RtlFreeUnicodeString(&CompatibleIds);
|
||||
return Status;
|
||||
}
|
||||
else if (Buffer[i] == 'M')
|
||||
{
|
||||
/* Sign for Microsoft Mouse protocol followed by button specifier */
|
||||
if (i == sizeof(Buffer) - 1)
|
||||
{
|
||||
/* Overflow Error */
|
||||
return STATUS_DEVICE_NOT_CONNECTED;
|
||||
}
|
||||
switch (Buffer[i + 1])
|
||||
{
|
||||
case '3':
|
||||
/* Hardware id: *PNP0F08
|
||||
* Compatible id: SERIAL_MOUSE
|
||||
*/
|
||||
RtlInitUnicodeString(&DeviceDescription, L"Microsoft Mouse with 3-buttons");
|
||||
RtlInitUnicodeString(&DeviceId, L"*PNP0F08");
|
||||
SerenumInitMultiSzString(&HardwareIds, "*PNP0F08", NULL);
|
||||
SerenumInitMultiSzString(&CompatibleIds, "SERIAL_MOUSE", NULL);
|
||||
default:
|
||||
/* Hardware id: *PNP0F01
|
||||
* Compatible id: SERIAL_MOUSE
|
||||
*/
|
||||
RtlInitUnicodeString(&DeviceDescription, L"Microsoft Mouse with 2-buttons or Microsoft Wheel Mouse");
|
||||
RtlInitUnicodeString(&DeviceId, L"*PNP0F01");
|
||||
SerenumInitMultiSzString(&HardwareIds, "*PNP0F01", NULL);
|
||||
SerenumInitMultiSzString(&CompatibleIds, "SERIAL_MOUSE", NULL);
|
||||
}
|
||||
Status = ReportDetectedDevice(DeviceObject,
|
||||
&DeviceDescription, &DeviceId, &HardwareIds, &CompatibleIds);
|
||||
RtlFreeUnicodeString(&HardwareIds);
|
||||
RtlFreeUnicodeString(&CompatibleIds);
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
|
||||
return STATUS_DEVICE_NOT_CONNECTED;
|
||||
}
|
213
reactos/drivers/bus/serenum/fdo.c
Normal file
213
reactos/drivers/bus/serenum/fdo.c
Normal file
@@ -0,0 +1,213 @@
|
||||
/* $Id:
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS Serial enumerator driver
|
||||
* FILE: drivers/bus/serenum/fdo.c
|
||||
* PURPOSE: IRP_MJ_PNP operations for FDOs
|
||||
*
|
||||
* PROGRAMMERS: Herv<72> Poussineau (hpoussin@reactos.com)
|
||||
*/
|
||||
|
||||
#define NDEBUG
|
||||
#include "serenum.h"
|
||||
|
||||
NTSTATUS STDCALL
|
||||
SerenumAddDevice(
|
||||
IN PDRIVER_OBJECT DriverObject,
|
||||
IN PDEVICE_OBJECT Pdo)
|
||||
{
|
||||
PDEVICE_OBJECT Fdo;
|
||||
PFDO_DEVICE_EXTENSION DeviceExtension;
|
||||
//UNICODE_STRING SymbolicLinkName;
|
||||
NTSTATUS Status;
|
||||
|
||||
DPRINT("Serenum: SerenumAddDevice called. Pdo = %p\n", Pdo);
|
||||
|
||||
/* Create new device object */
|
||||
Status = IoCreateDevice(DriverObject,
|
||||
sizeof(FDO_DEVICE_EXTENSION),
|
||||
NULL,
|
||||
FILE_DEVICE_BUS_EXTENDER,
|
||||
FILE_DEVICE_SECURE_OPEN,
|
||||
FALSE,
|
||||
&Fdo);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("Serenum: IoCreateDevice() failed with status 0x%08lx\n", Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* Register device interface */
|
||||
#if 0 /* FIXME: activate */
|
||||
Status = IoRegisterDeviceInterface(Pdo, &GUID_DEVINTERFACE_SERENUM_BUS_ENUMERATOR, NULL, &SymbolicLinkName);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("Serenum: IoRegisterDeviceInterface() failed with status 0x%08lx\n", Status);
|
||||
goto ByeBye;
|
||||
}
|
||||
DPRINT1("Serenum: IoRegisterDeviceInterface() returned '%wZ'\n", &SymbolicLinkName);
|
||||
Status = IoSetDeviceInterfaceState(&SymbolicLinkName, TRUE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("Serenum: IoSetDeviceInterfaceState() failed with status 0x%08lx\n", Status);
|
||||
goto ByeBye;
|
||||
}
|
||||
RtlFreeUnicodeString(&SymbolicLinkName);
|
||||
#endif
|
||||
|
||||
DeviceExtension = (PFDO_DEVICE_EXTENSION)Fdo->DeviceExtension;
|
||||
RtlZeroMemory(DeviceExtension, sizeof(FDO_DEVICE_EXTENSION));
|
||||
DeviceExtension->Common.IsFDO = TRUE;
|
||||
DeviceExtension->Common.PnpState = dsStopped;
|
||||
DeviceExtension->Pdo = Pdo;
|
||||
IoInitializeRemoveLock(&DeviceExtension->RemoveLock, SERENUM_TAG, 0, 0);
|
||||
Fdo->Flags |= DO_POWER_PAGABLE;
|
||||
Status = IoAttachDeviceToDeviceStackSafe(Fdo, Pdo, &DeviceExtension->LowerDevice);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("Serenum: IoAttachDeviceToDeviceStackSafe() failed with status 0x%08lx\n", Status);
|
||||
IoDeleteDevice(Fdo);
|
||||
return Status;
|
||||
}
|
||||
Fdo->Flags |= DO_BUFFERED_IO;
|
||||
Fdo->Flags &= ~DO_DEVICE_INITIALIZING;
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS STDCALL
|
||||
SerenumFdoStartDevice(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp)
|
||||
{
|
||||
PCOMMON_DEVICE_EXTENSION DeviceExtension;
|
||||
|
||||
DPRINT("Serenum: SerenumFdoStartDevice() called\n");
|
||||
DeviceExtension = (PCOMMON_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
|
||||
ASSERT(DeviceExtension->PnpState == dsStopped);
|
||||
DeviceExtension->PnpState = dsStarted;
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
SerenumFdoQueryBusRelations(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
OUT PDEVICE_RELATIONS* pDeviceRelations)
|
||||
{
|
||||
PFDO_DEVICE_EXTENSION DeviceExtension;
|
||||
PDEVICE_RELATIONS DeviceRelations;
|
||||
ULONG NumPDO;
|
||||
ULONG i;
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
|
||||
DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
ASSERT(DeviceExtension->Common.IsFDO);
|
||||
|
||||
/* Do enumeration if needed */
|
||||
if (!(DeviceExtension->Flags & FLAG_ENUMERATION_DONE))
|
||||
{
|
||||
ASSERT(DeviceExtension->AttachedPdo == NULL);
|
||||
/* Detect plug-and-play devices */
|
||||
Status = SerenumDetectPnpDevice(DeviceObject, DeviceExtension->LowerDevice);
|
||||
if (Status == STATUS_DEVICE_NOT_CONNECTED)
|
||||
{
|
||||
/* Detect legacy devices */
|
||||
Status = SerenumDetectLegacyDevice(DeviceObject, DeviceExtension->LowerDevice);
|
||||
if (Status == STATUS_DEVICE_NOT_CONNECTED)
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
DeviceExtension->Flags |= FLAG_ENUMERATION_DONE;
|
||||
}
|
||||
NumPDO = (DeviceExtension->AttachedPdo != NULL ? 1 : 0);
|
||||
|
||||
DeviceRelations = (PDEVICE_RELATIONS)ExAllocatePoolWithTag(
|
||||
PagedPool,
|
||||
sizeof(DEVICE_RELATIONS) + sizeof(PDEVICE_OBJECT) * (NumPDO - 1),
|
||||
SERENUM_TAG);
|
||||
if (!DeviceRelations)
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
||||
/* Fill returned structure */
|
||||
DeviceRelations->Count = NumPDO;
|
||||
for (i = 0; i < NumPDO; i++)
|
||||
{
|
||||
ObReferenceObject(DeviceExtension->AttachedPdo);
|
||||
DeviceRelations->Objects[i] = DeviceExtension->AttachedPdo;
|
||||
}
|
||||
|
||||
*pDeviceRelations = DeviceRelations;
|
||||
return Status;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
SerenumFdoPnp(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp)
|
||||
{
|
||||
ULONG MinorFunction;
|
||||
PIO_STACK_LOCATION Stack;
|
||||
ULONG_PTR Information = 0;
|
||||
NTSTATUS Status;
|
||||
|
||||
Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||
MinorFunction = Stack->MinorFunction;
|
||||
|
||||
switch (MinorFunction)
|
||||
{
|
||||
/* FIXME: do all these minor functions
|
||||
IRP_MN_QUERY_REMOVE_DEVICE 0x1
|
||||
IRP_MN_REMOVE_DEVICE 0x2
|
||||
IRP_MN_CANCEL_REMOVE_DEVICE 0x3
|
||||
IRP_MN_STOP_DEVICE 0x4
|
||||
IRP_MN_QUERY_STOP_DEVICE 0x5
|
||||
IRP_MN_CANCEL_STOP_DEVICE 0x6
|
||||
IRP_MN_QUERY_DEVICE_RELATIONS / RemovalRelations (optional) 0x7
|
||||
IRP_MN_QUERY_INTERFACE (optional) 0x8
|
||||
IRP_MN_QUERY_CAPABILITIES (optional) 0x9
|
||||
IRP_MN_FILTER_RESOURCE_REQUIREMENTS (optional or required) 0xb
|
||||
IRP_MN_QUERY_PNP_DEVICE_STATE (optional) 0x14
|
||||
IRP_MN_DEVICE_USAGE_NOTIFICATION (required or optional) 0x16
|
||||
IRP_MN_SURPRISE_REMOVAL 0x17
|
||||
*/
|
||||
case IRP_MN_START_DEVICE: /* 0x0 */
|
||||
{
|
||||
DPRINT("Serenum: IRP_MJ_PNP / IRP_MN_START_DEVICE\n");
|
||||
/* Call lower driver */
|
||||
Status = ForwardIrpAndWait(DeviceObject, Irp);
|
||||
if (NT_SUCCESS(Status))
|
||||
Status = SerenumFdoStartDevice(DeviceObject, Irp);
|
||||
break;
|
||||
}
|
||||
case IRP_MN_QUERY_DEVICE_RELATIONS: /* 0x7 */
|
||||
{
|
||||
switch (Stack->Parameters.QueryDeviceRelations.Type)
|
||||
{
|
||||
case BusRelations:
|
||||
{
|
||||
PDEVICE_RELATIONS DeviceRelations;
|
||||
DPRINT("Serenum: IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / BusRelations\n");
|
||||
Status = SerenumFdoQueryBusRelations(DeviceObject, &DeviceRelations);
|
||||
Information = (ULONG_PTR)DeviceRelations;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
DPRINT1("Serenum: IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / Unknown type 0x%lx\n",
|
||||
Stack->Parameters.QueryDeviceRelations.Type);
|
||||
return ForwardIrpAndForget(DeviceObject, Irp);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
DPRINT1("Serenum: IRP_MJ_PNP / unknown minor function 0x%lx\n", MinorFunction);
|
||||
return ForwardIrpAndForget(DeviceObject, Irp);
|
||||
}
|
||||
}
|
||||
|
||||
Irp->IoStatus.Information = Information;
|
||||
Irp->IoStatus.Status = Status;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
return Status;
|
||||
}
|
20
reactos/drivers/bus/serenum/makefile
Normal file
20
reactos/drivers/bus/serenum/makefile
Normal file
@@ -0,0 +1,20 @@
|
||||
# $Id: makefile 12852 2005-01-06 13:58:04Z mf $
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_TYPE = driver
|
||||
|
||||
TARGET_NAME = serenum
|
||||
|
||||
TARGET_CFLAGS = -Wall -Werror -D__USE_W32API
|
||||
|
||||
TARGET_OBJECTS = \
|
||||
detect.o \
|
||||
fdo.o \
|
||||
misc.o \
|
||||
pdo.o \
|
||||
serenum.o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
210
reactos/drivers/bus/serenum/misc.c
Normal file
210
reactos/drivers/bus/serenum/misc.c
Normal file
@@ -0,0 +1,210 @@
|
||||
/* $Id:
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS Serial enumerator driver
|
||||
* FILE: drivers/dd/serenum/misc.c
|
||||
* PURPOSE: Misceallenous operations
|
||||
*
|
||||
* PROGRAMMERS: Herv<72> Poussineau (hpoussin@reactos.com)
|
||||
*/
|
||||
|
||||
#define NDEBUG
|
||||
#include "serenum.h"
|
||||
#include <stdarg.h>
|
||||
|
||||
NTSTATUS
|
||||
SerenumDuplicateUnicodeString(
|
||||
OUT PUNICODE_STRING Destination,
|
||||
IN PUNICODE_STRING Source,
|
||||
IN POOL_TYPE PoolType)
|
||||
{
|
||||
ASSERT(Destination);
|
||||
|
||||
if (Source == NULL)
|
||||
{
|
||||
RtlInitUnicodeString(Destination, NULL);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
Destination->Buffer = ExAllocatePool(PoolType, Source->MaximumLength);
|
||||
if (Destination->Buffer == NULL)
|
||||
{
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
Destination->MaximumLength = Source->MaximumLength;
|
||||
Destination->Length = Source->Length;
|
||||
RtlCopyMemory(Destination->Buffer, Source->Buffer, Source->MaximumLength);
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* I really want ANSI strings as last arguments because
|
||||
* PnP ids are ANSI-encoded in PnP device string
|
||||
* identification */
|
||||
NTSTATUS
|
||||
SerenumInitMultiSzString(
|
||||
OUT PUNICODE_STRING Destination,
|
||||
... /* list of PCSZ */)
|
||||
{
|
||||
va_list args;
|
||||
PCSZ Source;
|
||||
ANSI_STRING AnsiString;
|
||||
UNICODE_STRING UnicodeString;
|
||||
ULONG DestinationSize = 0;
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
|
||||
ASSERT(Destination);
|
||||
|
||||
/* Calculate length needed for destination unicode string */
|
||||
va_start(args, Destination);
|
||||
Source = va_arg(args, PCSZ);
|
||||
while (Source != NULL)
|
||||
{
|
||||
RtlInitAnsiString(&AnsiString, Source);
|
||||
DestinationSize += RtlAnsiStringToUnicodeSize(&AnsiString)
|
||||
+ sizeof(WCHAR) /* final NULL */;
|
||||
Source = va_arg(args, PCSZ);
|
||||
}
|
||||
va_end(args);
|
||||
if (DestinationSize == 0)
|
||||
{
|
||||
RtlInitUnicodeString(Destination, NULL);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* Initialize destination string */
|
||||
DestinationSize += sizeof(WCHAR); // final NULL
|
||||
Destination->Buffer = (PWSTR)ExAllocatePoolWithTag(PagedPool, DestinationSize, SERENUM_TAG);
|
||||
if (!Destination->Buffer)
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
Destination->Length = 0;
|
||||
Destination->MaximumLength = (USHORT)DestinationSize;
|
||||
|
||||
/* Copy arguments to destination string */
|
||||
/* Use a temporary unicode string, which buffer is shared with
|
||||
* destination string, to copy arguments */
|
||||
UnicodeString.Length = Destination->Length;
|
||||
UnicodeString.MaximumLength = Destination->MaximumLength;
|
||||
UnicodeString.Buffer = Destination->Buffer;
|
||||
va_start(args, Destination);
|
||||
Source = va_arg(args, PCSZ);
|
||||
while (Source != NULL)
|
||||
{
|
||||
RtlInitAnsiString(&AnsiString, Source);
|
||||
Status = RtlAnsiStringToUnicodeString(&UnicodeString, &AnsiString, FALSE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ExFreePoolWithTag(Destination->Buffer, SERENUM_TAG);
|
||||
break;
|
||||
}
|
||||
Destination->Length += UnicodeString.Length + sizeof(WCHAR);
|
||||
UnicodeString.MaximumLength -= UnicodeString.Length + sizeof(WCHAR);
|
||||
UnicodeString.Buffer += UnicodeString.Length / sizeof(WCHAR) + 1;
|
||||
UnicodeString.Length = 0;
|
||||
Source = va_arg(args, PCSZ);
|
||||
}
|
||||
va_end(args);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
/* Finish multi-sz string */
|
||||
Destination->Buffer[Destination->Length / sizeof(WCHAR)] = L'\0';
|
||||
Destination->Length += sizeof(WCHAR);
|
||||
}
|
||||
return Status;
|
||||
}
|
||||
|
||||
NTSTATUS STDCALL
|
||||
ForwardIrpAndWaitCompletion(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp,
|
||||
IN PVOID Context)
|
||||
{
|
||||
if (Irp->PendingReturned)
|
||||
KeSetEvent((PKEVENT)Context, IO_NO_INCREMENT, FALSE);
|
||||
return STATUS_MORE_PROCESSING_REQUIRED;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
ForwardIrpAndWait(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp)
|
||||
{
|
||||
PDEVICE_OBJECT LowerDevice;
|
||||
KEVENT Event;
|
||||
NTSTATUS Status;
|
||||
|
||||
ASSERT(((PCOMMON_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsFDO);
|
||||
LowerDevice = ((PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->LowerDevice;
|
||||
|
||||
ASSERT(LowerDevice);
|
||||
|
||||
KeInitializeEvent(&Event, NotificationEvent, FALSE);
|
||||
IoCopyCurrentIrpStackLocationToNext(Irp);
|
||||
|
||||
DPRINT("Serenum: Calling lower device %p [%wZ]\n", LowerDevice, &LowerDevice->DriverObject->DriverName);
|
||||
IoSetCompletionRoutine(Irp, ForwardIrpAndWaitCompletion, &Event, TRUE, TRUE, TRUE);
|
||||
|
||||
Status = IoCallDriver(LowerDevice, Irp);
|
||||
if (Status == STATUS_PENDING)
|
||||
{
|
||||
Status = KeWaitForSingleObject(&Event, Suspended, KernelMode, FALSE, NULL);
|
||||
if (NT_SUCCESS(Status))
|
||||
Status = Irp->IoStatus.Status;
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
NTSTATUS STDCALL
|
||||
ForwardIrpToLowerDeviceAndForget(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp)
|
||||
{
|
||||
PFDO_DEVICE_EXTENSION DeviceExtension;
|
||||
PDEVICE_OBJECT LowerDevice;
|
||||
|
||||
DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
ASSERT(DeviceExtension->Common.IsFDO);
|
||||
|
||||
LowerDevice = DeviceExtension->LowerDevice;
|
||||
ASSERT(LowerDevice);
|
||||
DPRINT("Serenum: calling lower device 0x%p [%wZ]\n",
|
||||
LowerDevice, &LowerDevice->DriverObject->DriverName);
|
||||
IoSkipCurrentIrpStackLocation(Irp);
|
||||
return IoCallDriver(LowerDevice, Irp);
|
||||
}
|
||||
|
||||
NTSTATUS STDCALL
|
||||
ForwardIrpToAttachedFdoAndForget(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp)
|
||||
{
|
||||
PPDO_DEVICE_EXTENSION DeviceExtension;
|
||||
PDEVICE_OBJECT Fdo;
|
||||
|
||||
DeviceExtension = (PPDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
ASSERT(!DeviceExtension->Common.IsFDO);
|
||||
|
||||
Fdo = DeviceExtension->AttachedFdo;
|
||||
ASSERT(Fdo);
|
||||
DPRINT("Serenum: calling attached Fdo 0x%p [%wZ]\n",
|
||||
Fdo, &Fdo->DriverObject->DriverName);
|
||||
IoSkipCurrentIrpStackLocation(Irp);
|
||||
return IoCallDriver(Fdo, Irp);
|
||||
}
|
||||
|
||||
NTSTATUS STDCALL
|
||||
ForwardIrpAndForget(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp)
|
||||
{
|
||||
PDEVICE_OBJECT LowerDevice;
|
||||
|
||||
ASSERT(((PCOMMON_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsFDO);
|
||||
LowerDevice = ((PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->LowerDevice;
|
||||
ASSERT(LowerDevice);
|
||||
|
||||
IoSkipCurrentIrpStackLocation(Irp);
|
||||
return IoCallDriver(LowerDevice, Irp);
|
||||
}
|
314
reactos/drivers/bus/serenum/pdo.c
Normal file
314
reactos/drivers/bus/serenum/pdo.c
Normal file
@@ -0,0 +1,314 @@
|
||||
/* $Id:
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS Serial enumerator driver
|
||||
* FILE: drivers/bus/serenum/pdo.c
|
||||
* PURPOSE: IRP_MJ_PNP operations for PDOs
|
||||
*
|
||||
* PROGRAMMERS: Herv<72> Poussineau (hpoussin@reactos.com)
|
||||
*/
|
||||
|
||||
#define NDEBUG
|
||||
#include "serenum.h"
|
||||
|
||||
static NTSTATUS
|
||||
SerenumPdoStartDevice(
|
||||
IN PDEVICE_OBJECT DeviceObject)
|
||||
{
|
||||
PPDO_DEVICE_EXTENSION DeviceExtension;
|
||||
|
||||
DeviceExtension = (PPDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
|
||||
ASSERT(DeviceExtension->Common.PnpState == dsStopped);
|
||||
|
||||
DeviceExtension->Common.PnpState = dsStarted;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static NTSTATUS
|
||||
SerenumPdoQueryId(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp,
|
||||
OUT ULONG_PTR* Information)
|
||||
{
|
||||
PPDO_DEVICE_EXTENSION DeviceExtension;
|
||||
ULONG IdType;
|
||||
PUNICODE_STRING SourceString;
|
||||
UNICODE_STRING String;
|
||||
NTSTATUS Status;
|
||||
|
||||
IdType = IoGetCurrentIrpStackLocation(Irp)->Parameters.QueryId.IdType;
|
||||
DeviceExtension = (PPDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
RtlInitUnicodeString(&String, NULL);
|
||||
|
||||
switch (IdType)
|
||||
{
|
||||
case BusQueryDeviceID:
|
||||
{
|
||||
DPRINT("Serenum: IRP_MJ_PNP / IRP_MN_QUERY_ID / BusQueryDeviceID\n");
|
||||
SourceString = &DeviceExtension->DeviceId;
|
||||
break;
|
||||
}
|
||||
case BusQueryHardwareIDs:
|
||||
{
|
||||
DPRINT("Serenum: IRP_MJ_PNP / IRP_MN_QUERY_ID / BusQueryHardwareIDs\n");
|
||||
SourceString = &DeviceExtension->HardwareIds;
|
||||
break;
|
||||
}
|
||||
case BusQueryCompatibleIDs:
|
||||
DPRINT("Serenum: IRP_MJ_PNP / IRP_MN_QUERY_ID / BusQueryCompatibleIDs\n");
|
||||
SourceString = &DeviceExtension->CompatibleIds;
|
||||
break;
|
||||
case BusQueryInstanceID:
|
||||
{
|
||||
/* We don't have any instance id to report, and
|
||||
* this query is optional, so ignore it.
|
||||
*/
|
||||
*Information = Irp->IoStatus.Information;
|
||||
return Irp->IoStatus.Status;
|
||||
}
|
||||
default:
|
||||
DPRINT1("Serenum: IRP_MJ_PNP / IRP_MN_QUERY_ID / unknown query id type 0x%lx\n", IdType);
|
||||
return STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
Status = SerenumDuplicateUnicodeString(
|
||||
&String,
|
||||
SourceString,
|
||||
PagedPool);
|
||||
*Information = (ULONG_PTR)String.Buffer;
|
||||
return Status;
|
||||
}
|
||||
|
||||
static NTSTATUS
|
||||
SerenumPdoQueryDeviceRelations(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
OUT PDEVICE_RELATIONS* pDeviceRelations)
|
||||
{
|
||||
PFDO_DEVICE_EXTENSION DeviceExtension;
|
||||
PDEVICE_RELATIONS DeviceRelations;
|
||||
|
||||
DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
ASSERT(DeviceExtension->Common.IsFDO);
|
||||
|
||||
DeviceRelations = (PDEVICE_RELATIONS)ExAllocatePoolWithTag(
|
||||
PagedPool,
|
||||
sizeof(DEVICE_RELATIONS),
|
||||
SERENUM_TAG);
|
||||
if (!DeviceRelations)
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
||||
ObReferenceObject(DeviceObject);
|
||||
DeviceRelations->Count = 1;
|
||||
DeviceRelations->Objects[0] = DeviceObject;
|
||||
|
||||
*pDeviceRelations = DeviceRelations;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
SerenumPdoPnp(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp)
|
||||
{
|
||||
ULONG MinorFunction;
|
||||
PIO_STACK_LOCATION Stack;
|
||||
ULONG_PTR Information = 0;
|
||||
NTSTATUS Status;
|
||||
|
||||
Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||
MinorFunction = Stack->MinorFunction;
|
||||
|
||||
switch (MinorFunction)
|
||||
{
|
||||
/* FIXME: do all these minor functions
|
||||
IRP_MN_QUERY_REMOVE_DEVICE 0x1
|
||||
IRP_MN_REMOVE_DEVICE 0x2
|
||||
IRP_MN_CANCEL_REMOVE_DEVICE 0x3
|
||||
IRP_MN_STOP_DEVICE 0x4
|
||||
IRP_MN_QUERY_STOP_DEVICE 0x5
|
||||
IRP_MN_CANCEL_STOP_DEVICE 0x6
|
||||
IRP_MN_QUERY_DEVICE_RELATIONS / EjectionRelations (optional) 0x7
|
||||
IRP_MN_QUERY_INTERFACE (required or optional) 0x8
|
||||
IRP_MN_READ_CONFIG (required or optional) 0xf
|
||||
IRP_MN_WRITE_CONFIG (required or optional) 0x10
|
||||
IRP_MN_EJECT (required or optional) 0x11
|
||||
IRP_MN_SET_LOCK (required or optional) 0x12
|
||||
IRP_MN_QUERY_ID / BusQueryDeviceID 0x13
|
||||
IRP_MN_QUERY_ID / BusQueryCompatibleIDs (optional) 0x13
|
||||
IRP_MN_QUERY_ID / BusQueryInstanceID (optional) 0x13
|
||||
IRP_MN_QUERY_PNP_DEVICE_STATE (optional) 0x14
|
||||
IRP_MN_DEVICE_USAGE_NOTIFICATION (required or optional) 0x16
|
||||
IRP_MN_SURPRISE_REMOVAL 0x17
|
||||
*/
|
||||
case IRP_MN_START_DEVICE: /* 0x0 */
|
||||
{
|
||||
DPRINT("Serenum: IRP_MJ_PNP / IRP_MN_START_DEVICE\n");
|
||||
Status = SerenumPdoStartDevice(DeviceObject);
|
||||
break;
|
||||
}
|
||||
case IRP_MN_QUERY_DEVICE_RELATIONS: /* 0x7 */
|
||||
{
|
||||
switch (Stack->Parameters.QueryDeviceRelations.Type)
|
||||
{
|
||||
case RemovalRelations:
|
||||
{
|
||||
return ForwardIrpToAttachedFdoAndForget(DeviceObject, Irp);
|
||||
}
|
||||
case TargetDeviceRelation:
|
||||
{
|
||||
PDEVICE_RELATIONS DeviceRelations;
|
||||
DPRINT("Serenum: IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / TargetDeviceRelation\n");
|
||||
Status = SerenumPdoQueryDeviceRelations(DeviceObject, &DeviceRelations);
|
||||
Information = (ULONG_PTR)DeviceRelations;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
DPRINT1("Serenum: IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / Unknown type 0x%lx\n",
|
||||
Stack->Parameters.QueryDeviceRelations.Type);
|
||||
Status = STATUS_NOT_IMPLEMENTED;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case IRP_MN_QUERY_CAPABILITIES: /* 0x9 */
|
||||
{
|
||||
PDEVICE_CAPABILITIES DeviceCapabilities;
|
||||
ULONG i;
|
||||
DPRINT("Serenum: IRP_MJ_PNP / IRP_MN_QUERY_CAPABILITIES\n");
|
||||
|
||||
DeviceCapabilities = (PDEVICE_CAPABILITIES)Stack->Parameters.DeviceCapabilities.Capabilities;
|
||||
/* FIXME: capabilities can change with connected device */
|
||||
DeviceCapabilities->LockSupported = FALSE;
|
||||
DeviceCapabilities->EjectSupported = FALSE;
|
||||
DeviceCapabilities->Removable = TRUE;
|
||||
DeviceCapabilities->DockDevice = FALSE;
|
||||
DeviceCapabilities->UniqueID = FALSE;
|
||||
DeviceCapabilities->SilentInstall = FALSE;
|
||||
DeviceCapabilities->RawDeviceOK = TRUE;
|
||||
DeviceCapabilities->SurpriseRemovalOK = TRUE;
|
||||
DeviceCapabilities->HardwareDisabled = FALSE; /* FIXME */
|
||||
//DeviceCapabilities->NoDisplayInUI = FALSE; /* FIXME */
|
||||
DeviceCapabilities->DeviceState[0] = PowerDeviceD0; /* FIXME */
|
||||
for (i = 0; i < PowerSystemMaximum; i++)
|
||||
DeviceCapabilities->DeviceState[i] = PowerDeviceD3; /* FIXME */
|
||||
//DeviceCapabilities->DeviceWake = PowerDeviceUndefined; /* FIXME */
|
||||
DeviceCapabilities->D1Latency = 0; /* FIXME */
|
||||
DeviceCapabilities->D2Latency = 0; /* FIXME */
|
||||
DeviceCapabilities->D3Latency = 0; /* FIXME */
|
||||
Status = STATUS_SUCCESS;
|
||||
break;
|
||||
}
|
||||
case IRP_MN_QUERY_RESOURCES: /* 0xa */
|
||||
{
|
||||
DPRINT("Serenum: IRP_MJ_PNP / IRP_MN_QUERY_RESOURCES\n");
|
||||
/* Serial devices don't need resources, except the ones of
|
||||
* the serial port. This PDO is the serial device PDO, so
|
||||
* report no resource by not changing Information and
|
||||
* Status
|
||||
*/
|
||||
Information = Irp->IoStatus.Information;
|
||||
Status = Irp->IoStatus.Status;
|
||||
break;
|
||||
}
|
||||
case IRP_MN_QUERY_RESOURCE_REQUIREMENTS: /* 0xb */
|
||||
{
|
||||
DPRINT("Serenum: IRP_MJ_PNP / IRP_MN_QUERY_RESOURCE_REQUIREMENTS\n");
|
||||
/* Serial devices don't need resources, except the ones of
|
||||
* the serial port. This PDO is the serial device PDO, so
|
||||
* report no resource by not changing Information and
|
||||
* Status
|
||||
*/
|
||||
Information = Irp->IoStatus.Information;
|
||||
Status = Irp->IoStatus.Status;
|
||||
break;
|
||||
}
|
||||
case IRP_MN_QUERY_DEVICE_TEXT: /* 0xc */
|
||||
{
|
||||
switch (Stack->Parameters.QueryDeviceText.DeviceTextType)
|
||||
{
|
||||
case DeviceTextDescription:
|
||||
{
|
||||
PUNICODE_STRING Source;
|
||||
PWSTR Description;
|
||||
DPRINT("Serenum: IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_TEXT / DeviceTextDescription\n");
|
||||
|
||||
Source = &((PPDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->DeviceDescription;
|
||||
Description = ExAllocatePool(PagedPool, Source->Length + sizeof(WCHAR));
|
||||
if (!Description)
|
||||
Status = STATUS_INSUFFICIENT_RESOURCES;
|
||||
else
|
||||
{
|
||||
RtlCopyMemory(Description, Source->Buffer, Source->Length);
|
||||
Description[Source->Length / sizeof(WCHAR)] = L'\0';
|
||||
Information = (ULONG_PTR)Description;
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case DeviceTextLocationInformation:
|
||||
{
|
||||
/* We don't have any text location to report,
|
||||
* and this query is optional, so ignore it.
|
||||
*/
|
||||
Information = Irp->IoStatus.Information;
|
||||
Status = Irp->IoStatus.Status;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
DPRINT1("Serenum: IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_TEXT / unknown type 0x%lx\n",
|
||||
Stack->Parameters.QueryDeviceText.DeviceTextType);
|
||||
Status = STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case IRP_MN_FILTER_RESOURCE_REQUIREMENTS: /* 0xd */
|
||||
{
|
||||
return ForwardIrpToAttachedFdoAndForget(DeviceObject, Irp);
|
||||
}
|
||||
case IRP_MN_QUERY_ID: /* 0x13 */
|
||||
{
|
||||
Status = SerenumPdoQueryId(DeviceObject, Irp, &Information);
|
||||
break;
|
||||
}
|
||||
case IRP_MN_QUERY_BUS_INFORMATION: /* 0x15 */
|
||||
{
|
||||
PPNP_BUS_INFORMATION BusInfo;
|
||||
DPRINT("Serenum: IRP_MJ_PNP / IRP_MN_QUERY_BUS_INFORMATION\n");
|
||||
|
||||
BusInfo = (PPNP_BUS_INFORMATION)ExAllocatePool(PagedPool, sizeof(PNP_BUS_INFORMATION));
|
||||
if (!BusInfo)
|
||||
Status = STATUS_INSUFFICIENT_RESOURCES;
|
||||
else
|
||||
{
|
||||
BusInfo->BusTypeGuid = GUID_BUS_TYPE_SERENUM;
|
||||
/* FIXME: real value should be PNPBus, but PNPBus seems to be
|
||||
* the only value in INTERFACE_TYPE enum that doesn't work...
|
||||
*/
|
||||
BusInfo->LegacyBusType = PNPISABus;
|
||||
/* We're the only serial bus enumerator on the computer */
|
||||
BusInfo->BusNumber = 0;
|
||||
Information = (ULONG_PTR)BusInfo;
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
/* We can't forward request to the lower driver, because
|
||||
* we are a Pdo, so we don't have lower driver... */
|
||||
DPRINT1("Serenum: IRP_MJ_PNP / unknown minor function 0x%lx\n", MinorFunction);
|
||||
Information = Irp->IoStatus.Information;
|
||||
Status = Irp->IoStatus.Status;
|
||||
}
|
||||
}
|
||||
|
||||
Irp->IoStatus.Information = Information;
|
||||
Irp->IoStatus.Status = Status;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
return Status;
|
||||
}
|
112
reactos/drivers/bus/serenum/serenum.c
Normal file
112
reactos/drivers/bus/serenum/serenum.c
Normal file
@@ -0,0 +1,112 @@
|
||||
/* $Id:
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS Serial enumerator driver
|
||||
* FILE: drivers/bus/serenum/serenum.c
|
||||
* PURPOSE: Serial enumeration driver entry point
|
||||
*
|
||||
* PROGRAMMERS: Herv<72> Poussineau (hpoussin@reactos.com)
|
||||
*/
|
||||
|
||||
//#define NDEBUG
|
||||
#define INITGUID
|
||||
#include "serenum.h"
|
||||
|
||||
NTSTATUS STDCALL
|
||||
SerenumPnp(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp)
|
||||
{
|
||||
if (((PCOMMON_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsFDO)
|
||||
return SerenumFdoPnp(DeviceObject, Irp);
|
||||
else
|
||||
return SerenumPdoPnp(DeviceObject, Irp);
|
||||
}
|
||||
|
||||
VOID STDCALL
|
||||
DriverUnload(IN PDRIVER_OBJECT DriverObject)
|
||||
{
|
||||
// nothing to do here yet
|
||||
}
|
||||
|
||||
NTSTATUS STDCALL
|
||||
IrpStub(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp)
|
||||
{
|
||||
NTSTATUS Status = STATUS_NOT_SUPPORTED;
|
||||
|
||||
if (((PCOMMON_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsFDO)
|
||||
{
|
||||
/* Forward some IRPs to lower device */
|
||||
switch (IoGetCurrentIrpStackLocation(Irp)->MajorFunction)
|
||||
{
|
||||
case IRP_MJ_CREATE:
|
||||
case IRP_MJ_CLOSE:
|
||||
case IRP_MJ_CLEANUP:
|
||||
case IRP_MJ_READ:
|
||||
case IRP_MJ_WRITE:
|
||||
case IRP_MJ_DEVICE_CONTROL:
|
||||
return ForwardIrpToLowerDeviceAndForget(DeviceObject, Irp);
|
||||
default:
|
||||
{
|
||||
DPRINT1("Serenum: FDO stub for major function 0x%lx\n",
|
||||
IoGetCurrentIrpStackLocation(Irp)->MajorFunction);
|
||||
#ifndef NDEBUG
|
||||
DbgBreakPoint();
|
||||
#endif
|
||||
Status = Irp->IoStatus.Status;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Forward some IRPs to attached FDO */
|
||||
switch (IoGetCurrentIrpStackLocation(Irp)->MajorFunction)
|
||||
{
|
||||
case IRP_MJ_CREATE:
|
||||
case IRP_MJ_CLOSE:
|
||||
case IRP_MJ_CLEANUP:
|
||||
case IRP_MJ_READ:
|
||||
case IRP_MJ_WRITE:
|
||||
case IRP_MJ_DEVICE_CONTROL:
|
||||
return ForwardIrpToAttachedFdoAndForget(DeviceObject, Irp);
|
||||
default:
|
||||
{
|
||||
DPRINT1("Serenum: PDO stub for major function 0x%lx\n",
|
||||
IoGetCurrentIrpStackLocation(Irp)->MajorFunction);
|
||||
#ifndef NDEBUG
|
||||
DbgBreakPoint();
|
||||
#endif
|
||||
Status = Irp->IoStatus.Status;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Irp->IoStatus.Status = Status;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
return Status;
|
||||
}
|
||||
|
||||
/*
|
||||
* Standard DriverEntry method.
|
||||
*/
|
||||
NTSTATUS STDCALL
|
||||
DriverEntry(
|
||||
IN PDRIVER_OBJECT DriverObject,
|
||||
IN PUNICODE_STRING RegPath)
|
||||
{
|
||||
ULONG i;
|
||||
|
||||
DriverObject->DriverUnload = DriverUnload;
|
||||
DriverObject->DriverExtension->AddDevice = SerenumAddDevice;
|
||||
|
||||
for (i = 0; i < IRP_MJ_MAXIMUM_FUNCTION; i++)
|
||||
DriverObject->MajorFunction[i] = IrpStub;
|
||||
|
||||
//DriverObject->MajorFunction[IRP_MJ_QUERY_INFORMATION] = SerialQueryInformation;
|
||||
DriverObject->MajorFunction[IRP_MJ_PNP] = SerenumPnp;
|
||||
//DriverObject->MajorFunction[IRP_MJ_POWER] = SerialPower;
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
152
reactos/drivers/bus/serenum/serenum.h
Normal file
152
reactos/drivers/bus/serenum/serenum.h
Normal file
@@ -0,0 +1,152 @@
|
||||
#if defined(__GNUC__)
|
||||
#include <ddk/ntddk.h>
|
||||
#include <ddk/ntddser.h>
|
||||
#include <ddk/wdmguid.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <debug.h>
|
||||
|
||||
#define SR_MSR_DSR 0x20
|
||||
#define ExFreePoolWithTag(p, tag) ExFreePool(p)
|
||||
|
||||
/* FIXME: these prototypes MUST NOT be here! */
|
||||
NTSTATUS STDCALL
|
||||
IoAttachDeviceToDeviceStackSafe(
|
||||
IN PDEVICE_OBJECT SourceDevice,
|
||||
IN PDEVICE_OBJECT TargetDevice,
|
||||
OUT PDEVICE_OBJECT *AttachedToDeviceObject);
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
#include <ntddk.h>
|
||||
#include <ntddser.h>
|
||||
#include <c:/progra~1/winddk/inc/ddk/wdm/wxp/wdmguid.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define STDCALL
|
||||
|
||||
#define DPRINT1 DbgPrint("(%s:%d) ", __FILE__, __LINE__), DbgPrint
|
||||
#define CHECKPOINT1 DbgPrint("(%s:%d)\n")
|
||||
|
||||
#define TAG(A, B, C, D) (ULONG)(((A)<<0) + ((B)<<8) + ((C)<<16) + ((D)<<24))
|
||||
|
||||
NTSTATUS STDCALL
|
||||
IoAttachDeviceToDeviceStackSafe(
|
||||
IN PDEVICE_OBJECT SourceDevice,
|
||||
IN PDEVICE_OBJECT TargetDevice,
|
||||
OUT PDEVICE_OBJECT *AttachedToDeviceObject);
|
||||
|
||||
#define DPRINT DPRINT1
|
||||
#define CHECKPOINT CHECKPOINT1
|
||||
|
||||
#define SR_MSR_DSR 0x20
|
||||
#else
|
||||
#error Unknown compiler!
|
||||
#endif
|
||||
|
||||
typedef enum
|
||||
{
|
||||
dsStopped,
|
||||
dsStarted,
|
||||
dsPaused,
|
||||
dsRemoved,
|
||||
dsSurpriseRemoved
|
||||
} SERENUM_DEVICE_STATE;
|
||||
|
||||
typedef struct _COMMON_DEVICE_EXTENSION
|
||||
{
|
||||
BOOLEAN IsFDO;
|
||||
SERENUM_DEVICE_STATE PnpState;
|
||||
} COMMON_DEVICE_EXTENSION, *PCOMMON_DEVICE_EXTENSION;
|
||||
|
||||
typedef struct _FDO_DEVICE_EXTENSION
|
||||
{
|
||||
COMMON_DEVICE_EXTENSION Common;
|
||||
|
||||
PDEVICE_OBJECT LowerDevice;
|
||||
PDEVICE_OBJECT Pdo;
|
||||
IO_REMOVE_LOCK RemoveLock;
|
||||
|
||||
PDEVICE_OBJECT AttachedPdo;
|
||||
ULONG Flags;
|
||||
} FDO_DEVICE_EXTENSION, *PFDO_DEVICE_EXTENSION;
|
||||
|
||||
typedef struct _PDO_DEVICE_EXTENSION
|
||||
{
|
||||
COMMON_DEVICE_EXTENSION Common;
|
||||
|
||||
PDEVICE_OBJECT AttachedFdo;
|
||||
|
||||
UNICODE_STRING DeviceDescription; // REG_SZ
|
||||
UNICODE_STRING DeviceId; // REG_SZ
|
||||
UNICODE_STRING HardwareIds; // REG_MULTI_SZ
|
||||
UNICODE_STRING CompatibleIds; // REG_MULTI_SZ
|
||||
} PDO_DEVICE_EXTENSION, *PPDO_DEVICE_EXTENSION;
|
||||
|
||||
#define SERENUM_TAG TAG('S', 'e', 'r', 'e')
|
||||
|
||||
/* Flags */
|
||||
#define FLAG_ENUMERATION_DONE 0x01
|
||||
|
||||
/************************************ detect.c */
|
||||
|
||||
NTSTATUS
|
||||
SerenumDetectPnpDevice(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PDEVICE_OBJECT LowerDevice);
|
||||
|
||||
NTSTATUS
|
||||
SerenumDetectLegacyDevice(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PDEVICE_OBJECT LowerDevice);
|
||||
|
||||
/************************************ fdo.c */
|
||||
|
||||
NTSTATUS STDCALL
|
||||
SerenumAddDevice(
|
||||
IN PDRIVER_OBJECT DriverObject,
|
||||
IN PDEVICE_OBJECT Pdo);
|
||||
|
||||
NTSTATUS
|
||||
SerenumFdoPnp(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp);
|
||||
|
||||
/************************************ misc.c */
|
||||
|
||||
NTSTATUS
|
||||
SerenumDuplicateUnicodeString(
|
||||
OUT PUNICODE_STRING Destination,
|
||||
IN PUNICODE_STRING Source,
|
||||
IN POOL_TYPE PoolType);
|
||||
|
||||
NTSTATUS
|
||||
SerenumInitMultiSzString(
|
||||
OUT PUNICODE_STRING Destination,
|
||||
... /* list of ANSI_STRINGs */);
|
||||
|
||||
NTSTATUS
|
||||
ForwardIrpAndWait(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp);
|
||||
|
||||
NTSTATUS STDCALL
|
||||
ForwardIrpToLowerDeviceAndForget(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp);
|
||||
|
||||
NTSTATUS STDCALL
|
||||
ForwardIrpToAttachedFdoAndForget(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp);
|
||||
|
||||
NTSTATUS STDCALL
|
||||
ForwardIrpAndForget(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp);
|
||||
|
||||
/************************************ pdo.c */
|
||||
|
||||
NTSTATUS
|
||||
SerenumPdoPnp(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp);
|
7
reactos/drivers/bus/serenum/serenum.rc
Normal file
7
reactos/drivers/bus/serenum/serenum.rc
Normal file
@@ -0,0 +1,7 @@
|
||||
/* $Id$ */
|
||||
|
||||
#define REACTOS_VERSION_DLL
|
||||
#define REACTOS_STR_FILE_DESCRIPTION "Serial port enumerator\0"
|
||||
#define REACTOS_STR_INTERNAL_NAME "serenum\0"
|
||||
#define REACTOS_STR_ORIGINAL_FILENAME "serenum.sys\0"
|
||||
#include <reactos/version.rc>
|
38
reactos/drivers/dd/green/createclose.c
Normal file
38
reactos/drivers/dd/green/createclose.c
Normal file
@@ -0,0 +1,38 @@
|
||||
/* $Id:
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS VT100 emulator
|
||||
* FILE: drivers/dd/green/createclose.c
|
||||
* PURPOSE: IRP_MJ_CREATE, IRP_MJ_CLOSE and IRP_MJ_CLEANUP operations
|
||||
*
|
||||
* PROGRAMMERS: Herv<72> Poussineau (hpoussin@reactos.com)
|
||||
*/
|
||||
|
||||
//#define NDEBUG
|
||||
#include "green.h"
|
||||
|
||||
NTSTATUS STDCALL
|
||||
GreenCreate(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp)
|
||||
{
|
||||
DPRINT("Green: IRP_MJ_CREATE\n");
|
||||
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
Irp->IoStatus.Information = 0;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS STDCALL
|
||||
GreenClose(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp)
|
||||
{
|
||||
DPRINT("Green: IRP_MJ_CLOSE\n");
|
||||
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
Irp->IoStatus.Information = 0;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
65
reactos/drivers/dd/green/dispatch.c
Normal file
65
reactos/drivers/dd/green/dispatch.c
Normal file
@@ -0,0 +1,65 @@
|
||||
/* $Id:
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS VT100 emulator
|
||||
* FILE: drivers/dd/green/dispatch.c
|
||||
* PURPOSE: Dispatch routines
|
||||
*
|
||||
* PROGRAMMERS: Herv<72> Poussineau (hpoussin@reactos.com)
|
||||
*/
|
||||
|
||||
#define NDEBUG
|
||||
#include "green.h"
|
||||
|
||||
NTSTATUS STDCALL
|
||||
GreenDispatch(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp)
|
||||
{
|
||||
ULONG MajorFunction;
|
||||
GREEN_DEVICE_TYPE DeviceType;
|
||||
ULONG_PTR Information;
|
||||
NTSTATUS Status;
|
||||
|
||||
MajorFunction = IoGetCurrentIrpStackLocation(Irp)->MajorFunction;
|
||||
DeviceType = ((PCOMMON_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->Type;
|
||||
|
||||
Information = Irp->IoStatus.Information;
|
||||
Status = Irp->IoStatus.Status;
|
||||
|
||||
DPRINT("Green: Dispatching major function 0x%lx, DeviceType %d\n",
|
||||
MajorFunction, DeviceType);
|
||||
|
||||
if (MajorFunction == IRP_MJ_CREATE && DeviceType == Green)
|
||||
return GreenCreate(DeviceObject, Irp);
|
||||
else if (MajorFunction == IRP_MJ_CLOSE && DeviceType == Green)
|
||||
return GreenClose(DeviceObject, Irp);
|
||||
else if (MajorFunction == IRP_MJ_INTERNAL_DEVICE_CONTROL && DeviceType == Green)
|
||||
{
|
||||
return KeyboardInternalDeviceControl(
|
||||
((PGREEN_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->Keyboard,
|
||||
Irp);
|
||||
}
|
||||
else if (MajorFunction == IRP_MJ_INTERNAL_DEVICE_CONTROL && DeviceType == Keyboard)
|
||||
return KeyboardInternalDeviceControl(DeviceObject, Irp);
|
||||
else if (MajorFunction == IRP_MJ_DEVICE_CONTROL && DeviceType == Green)
|
||||
{
|
||||
return ScreenDeviceControl(
|
||||
((PGREEN_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->Screen,
|
||||
Irp);
|
||||
}
|
||||
else if (MajorFunction == IRP_MJ_DEVICE_CONTROL && DeviceType == Screen)
|
||||
return ScreenDeviceControl(DeviceObject, Irp);
|
||||
else if (MajorFunction == IRP_MJ_WRITE && DeviceType == Screen)
|
||||
return ScreenWrite(DeviceObject, Irp);
|
||||
else
|
||||
{
|
||||
DPRINT1("Green: unknown combination: MajorFunction 0x%lx, DeviceType %d\n",
|
||||
MajorFunction, DeviceType);
|
||||
}
|
||||
|
||||
Irp->IoStatus.Information = Information;
|
||||
Irp->IoStatus.Status = Status;
|
||||
IoCompleteRequest (Irp, IO_NO_INCREMENT);
|
||||
return Status;
|
||||
}
|
44
reactos/drivers/dd/green/green.c
Normal file
44
reactos/drivers/dd/green/green.c
Normal file
@@ -0,0 +1,44 @@
|
||||
/* $Id:
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS VT100 emulator
|
||||
* FILE: drivers/dd/green/green.c
|
||||
* PURPOSE: Driver entry point
|
||||
*
|
||||
* PROGRAMMERS: Herv<72> Poussineau (hpoussin@reactos.com)
|
||||
*/
|
||||
|
||||
//#define NDEBUG
|
||||
#include "green.h"
|
||||
|
||||
VOID STDCALL
|
||||
DriverUnload(IN PDRIVER_OBJECT DriverObject)
|
||||
{
|
||||
// nothing to do here yet
|
||||
}
|
||||
|
||||
/*
|
||||
* Standard DriverEntry method.
|
||||
*/
|
||||
NTSTATUS STDCALL
|
||||
DriverEntry(
|
||||
IN PDRIVER_OBJECT DriverObject,
|
||||
IN PUNICODE_STRING RegPath)
|
||||
{
|
||||
ULONG i;
|
||||
|
||||
DriverObject->DriverUnload = DriverUnload;
|
||||
DriverObject->DriverExtension->AddDevice = GreenAddDevice;
|
||||
|
||||
for (i = 0; i < IRP_MJ_MAXIMUM_FUNCTION; i++)
|
||||
DriverObject->MajorFunction[i] = GreenDispatch;
|
||||
|
||||
/* keyboard only */
|
||||
//DriverObject->DriverStartIo = GreenStartIo;
|
||||
|
||||
/* keyboard and screen */
|
||||
DriverObject->MajorFunction[IRP_MJ_CREATE] = GreenCreate;
|
||||
DriverObject->MajorFunction[IRP_MJ_CLOSE] = GreenClose;
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
179
reactos/drivers/dd/green/green.h
Normal file
179
reactos/drivers/dd/green/green.h
Normal file
@@ -0,0 +1,179 @@
|
||||
#if defined(__GNUC__)
|
||||
#include <ddk/ntddk.h>
|
||||
#include <ddk/ntddser.h>
|
||||
#include <ntos/halfuncs.h>
|
||||
#include <ddk/ntddblue.h>
|
||||
#include <ddk/ntddkbd.h> /* should be in kbdmou.h */
|
||||
|
||||
#include <debug.h>
|
||||
|
||||
/* FIXME: should be in kbdmou.h */
|
||||
typedef struct _CONNECT_DATA {
|
||||
PDEVICE_OBJECT ClassDeviceObject;
|
||||
PVOID ClassService;
|
||||
} CONNECT_DATA, *PCONNECT_DATA;
|
||||
|
||||
/* FIXME: should be in kbdmou.h */
|
||||
#define IOCTL_INTERNAL_KEYBOARD_CONNECT \
|
||||
CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0080, METHOD_NEITHER, FILE_ANY_ACCESS)
|
||||
|
||||
NTSTATUS STDCALL
|
||||
ObReferenceObjectByName(PUNICODE_STRING ObjectPath,
|
||||
ULONG Attributes,
|
||||
PACCESS_STATE PassedAccessState,
|
||||
ACCESS_MASK DesiredAccess,
|
||||
POBJECT_TYPE ObjectType,
|
||||
KPROCESSOR_MODE AccessMode,
|
||||
PVOID ParseContext,
|
||||
PVOID* ObjectPtr);
|
||||
|
||||
/* FIXME: should be in kbdmou.h */
|
||||
typedef VOID (*PSERVICE_CALLBACK_ROUTINE)(PDEVICE_OBJECT, PKEYBOARD_INPUT_DATA, PKEYBOARD_INPUT_DATA, PULONG);
|
||||
|
||||
typedef struct _CLASS_INFORMATION
|
||||
{
|
||||
PDEVICE_OBJECT DeviceObject;
|
||||
PVOID CallBack;
|
||||
} CLASS_INFORMATION, *PCLASS_INFORMATION;
|
||||
|
||||
#define KEYBOARD_BUFFER_SIZE 100
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
#include <ntddk.h>
|
||||
#include <ntddser.h>
|
||||
#include <kbdmou.h>
|
||||
|
||||
#define STDCALL
|
||||
|
||||
#define DPRINT1 DbgPrint("(%s:%d) ", __FILE__, __LINE__), DbgPrint
|
||||
#define CHECKPOINT1 DbgPrint("(%s:%d)\n", __FILE__, __LINE__)
|
||||
#define DPRINT DPRINT1
|
||||
#define CHECKPOINT CHECKPOINT1
|
||||
#else
|
||||
#error Unknown compiler!
|
||||
#endif
|
||||
|
||||
typedef enum
|
||||
{
|
||||
Green,
|
||||
Screen,
|
||||
Keyboard
|
||||
} GREEN_DEVICE_TYPE;
|
||||
|
||||
typedef struct _COMMON_DEVICE_EXTENSION
|
||||
{
|
||||
GREEN_DEVICE_TYPE Type;
|
||||
} COMMON_DEVICE_EXTENSION, *PCOMMON_DEVICE_EXTENSION;
|
||||
|
||||
typedef struct _KEYBOARD_DEVICE_EXTENSION
|
||||
{
|
||||
COMMON_DEVICE_EXTENSION Common;
|
||||
PDEVICE_OBJECT Green;
|
||||
|
||||
CLASS_INFORMATION ClassInformation;
|
||||
HANDLE WorkerThreadHandle;
|
||||
KDPC KeyboardDpc;
|
||||
|
||||
ULONG ActiveQueue;
|
||||
ULONG InputDataCount[2];
|
||||
KEYBOARD_INPUT_DATA KeyboardInputData[2][KEYBOARD_BUFFER_SIZE];
|
||||
} KEYBOARD_DEVICE_EXTENSION, *PKEYBOARD_DEVICE_EXTENSION;
|
||||
|
||||
typedef struct _SCREEN_DEVICE_EXTENSION
|
||||
{
|
||||
COMMON_DEVICE_EXTENSION Common;
|
||||
PDEVICE_OBJECT Green;
|
||||
|
||||
PUCHAR VideoMemory; /* Pointer to video memory */
|
||||
USHORT CharAttribute; /* Current color attribute */
|
||||
ULONG Mode;
|
||||
UCHAR ScanLines; /* Height of a text line */
|
||||
UCHAR Rows; /* Number of rows */
|
||||
UCHAR Columns; /* Number of columns */
|
||||
UCHAR TabWidth;
|
||||
|
||||
ULONG LogicalOffset; /* Position of the cursor */
|
||||
|
||||
UCHAR SendBuffer[1024];
|
||||
ULONG SendBufferPosition;
|
||||
} SCREEN_DEVICE_EXTENSION, *PSCREEN_DEVICE_EXTENSION;
|
||||
|
||||
typedef struct _GREEN_DEVICE_EXTENSION
|
||||
{
|
||||
COMMON_DEVICE_EXTENSION Common;
|
||||
PDEVICE_OBJECT Serial;
|
||||
|
||||
PDEVICE_OBJECT LowerDevice;
|
||||
ULONG BaudRate;
|
||||
SERIAL_LINE_CONTROL LineControl;
|
||||
SERIAL_TIMEOUTS Timeouts;
|
||||
|
||||
PDEVICE_OBJECT Keyboard;
|
||||
PDEVICE_OBJECT Screen;
|
||||
} GREEN_DEVICE_EXTENSION, *PGREEN_DEVICE_EXTENSION;
|
||||
|
||||
/************************************ createclose.c */
|
||||
|
||||
NTSTATUS STDCALL
|
||||
GreenCreate(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp);
|
||||
|
||||
NTSTATUS STDCALL
|
||||
GreenClose(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp);
|
||||
|
||||
/************************************ dispatch.c */
|
||||
|
||||
NTSTATUS STDCALL
|
||||
GreenDispatch(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp);
|
||||
|
||||
/************************************ keyboard.c */
|
||||
|
||||
NTSTATUS
|
||||
KeyboardInitialize(
|
||||
IN PDRIVER_OBJECT DriverObject,
|
||||
OUT PDEVICE_OBJECT* KeyboardFdo);
|
||||
|
||||
NTSTATUS
|
||||
KeyboardInternalDeviceControl(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp);
|
||||
|
||||
/************************************ misc.c */
|
||||
|
||||
NTSTATUS
|
||||
GreenDeviceIoControl(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN ULONG CtlCode,
|
||||
IN PVOID InputBuffer OPTIONAL,
|
||||
IN ULONG InputBufferSize,
|
||||
IN OUT PVOID OutputBuffer OPTIONAL,
|
||||
IN OUT PULONG OutputBufferSize);
|
||||
|
||||
/************************************ pnp.c */
|
||||
|
||||
NTSTATUS STDCALL
|
||||
GreenAddDevice(
|
||||
IN PDRIVER_OBJECT DriverObject,
|
||||
IN PDEVICE_OBJECT Pdo);
|
||||
|
||||
/************************************ screen.c */
|
||||
|
||||
NTSTATUS
|
||||
ScreenInitialize(
|
||||
IN PDRIVER_OBJECT DriverObject,
|
||||
OUT PDEVICE_OBJECT* ScreenFdo);
|
||||
|
||||
NTSTATUS
|
||||
ScreenWrite(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp);
|
||||
|
||||
NTSTATUS
|
||||
ScreenDeviceControl(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp);
|
5
reactos/drivers/dd/green/green.rc
Normal file
5
reactos/drivers/dd/green/green.rc
Normal file
@@ -0,0 +1,5 @@
|
||||
#define REACTOS_VERSION_DLL
|
||||
#define REACTOS_STR_FILE_DESCRIPTION "VT100 Server Driver\0"
|
||||
#define REACTOS_STR_INTERNAL_NAME "green\0"
|
||||
#define REACTOS_STR_ORIGINAL_FILENAME "green.sys\0"
|
||||
#include <reactos/version.rc>
|
346
reactos/drivers/dd/green/keyboard.c
Normal file
346
reactos/drivers/dd/green/keyboard.c
Normal file
@@ -0,0 +1,346 @@
|
||||
/* $Id:
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS VT100 emulator
|
||||
* FILE: drivers/dd/green/keyboard.c
|
||||
* PURPOSE: Keyboard part of green management
|
||||
*
|
||||
* PROGRAMMERS: Herv<72> Poussineau (hpoussin@reactos.com)
|
||||
*/
|
||||
|
||||
#define NDEBUG
|
||||
#include "green.h"
|
||||
|
||||
static BOOLEAN
|
||||
TranslateCharToScanCodes(
|
||||
IN PUCHAR InputBuffer,
|
||||
IN ULONG InputBufferSize,
|
||||
OUT KEYBOARD_INPUT_DATA* OutputBuffer,
|
||||
OUT PULONG OutputBufferSize,
|
||||
OUT PULONG BytesConsumed)
|
||||
{
|
||||
BOOLEAN NormalKey = FALSE;
|
||||
USHORT MakeCode;
|
||||
|
||||
if (InputBufferSize == 0)
|
||||
return FALSE;
|
||||
|
||||
switch (*InputBuffer)
|
||||
{
|
||||
case 0x1b: MakeCode = 0x01; NormalKey = TRUE; break; /* ESC */
|
||||
|
||||
case '1': MakeCode = 0x02; NormalKey = TRUE; break;
|
||||
case '2': MakeCode = 0x03; NormalKey = TRUE; break;
|
||||
case '3': MakeCode = 0x04; NormalKey = TRUE; break;
|
||||
case '4': MakeCode = 0x05; NormalKey = TRUE; break;
|
||||
case '5': MakeCode = 0x06; NormalKey = TRUE; break;
|
||||
case '6': MakeCode = 0x07; NormalKey = TRUE; break;
|
||||
case '7': MakeCode = 0x08; NormalKey = TRUE; break;
|
||||
case '8': MakeCode = 0x09; NormalKey = TRUE; break;
|
||||
case '9': MakeCode = 0x0a; NormalKey = TRUE; break;
|
||||
case '0': MakeCode = 0x0b; NormalKey = TRUE; break;
|
||||
case '-': MakeCode = 0x0c; NormalKey = TRUE; break;
|
||||
case '=': MakeCode = 0x0d; NormalKey = TRUE; break;
|
||||
case '\b': MakeCode = 0x0e; NormalKey = TRUE; break;
|
||||
|
||||
case '\t': MakeCode = 0x0f; NormalKey = TRUE; break;
|
||||
case 'q': MakeCode = 0x10; NormalKey = TRUE; break;
|
||||
case 'w': MakeCode = 0x11; NormalKey = TRUE; break;
|
||||
case 'e': MakeCode = 0x12; NormalKey = TRUE; break;
|
||||
case 'r': MakeCode = 0x13; NormalKey = TRUE; break;
|
||||
case 't': MakeCode = 0x14; NormalKey = TRUE; break;
|
||||
case 'y': MakeCode = 0x15; NormalKey = TRUE; break;
|
||||
case 'u': MakeCode = 0x16; NormalKey = TRUE; break;
|
||||
case 'i': MakeCode = 0x17; NormalKey = TRUE; break;
|
||||
case 'o': MakeCode = 0x18; NormalKey = TRUE; break;
|
||||
case 'p': MakeCode = 0x19; NormalKey = TRUE; break;
|
||||
case '[': MakeCode = 0x1a; NormalKey = TRUE; break;
|
||||
case ']': MakeCode = 0x1b; NormalKey = TRUE; break;
|
||||
|
||||
case '\r': MakeCode = 0x1c; NormalKey = TRUE; break;
|
||||
|
||||
case 'a': MakeCode = 0x1e; NormalKey = TRUE; break;
|
||||
case 's': MakeCode = 0x1f; NormalKey = TRUE; break;
|
||||
case 'd': MakeCode = 0x20; NormalKey = TRUE; break;
|
||||
case 'f': MakeCode = 0x21; NormalKey = TRUE; break;
|
||||
case 'g': MakeCode = 0x22; NormalKey = TRUE; break;
|
||||
case 'h': MakeCode = 0x23; NormalKey = TRUE; break;
|
||||
case 'j': MakeCode = 0x24; NormalKey = TRUE; break;
|
||||
case 'k': MakeCode = 0x25; NormalKey = TRUE; break;
|
||||
case 'l': MakeCode = 0x26; NormalKey = TRUE; break;
|
||||
case ';': MakeCode = 0x27; NormalKey = TRUE; break;
|
||||
case '\'': MakeCode = 0x28; NormalKey = TRUE; break;
|
||||
|
||||
case '`': MakeCode = 0x29; NormalKey = TRUE; break;
|
||||
|
||||
case '\\': MakeCode = 0x2b; NormalKey = TRUE; break;
|
||||
|
||||
case 'z': MakeCode = 0x2c; NormalKey = TRUE; break;
|
||||
case 'x': MakeCode = 0x2d; NormalKey = TRUE; break;
|
||||
case 'c': MakeCode = 0x2e; NormalKey = TRUE; break;
|
||||
case 'v': MakeCode = 0x2f; NormalKey = TRUE; break;
|
||||
case 'b': MakeCode = 0x30; NormalKey = TRUE; break;
|
||||
case 'n': MakeCode = 0x31; NormalKey = TRUE; break;
|
||||
case 'm': MakeCode = 0x32; NormalKey = TRUE; break;
|
||||
case ',': MakeCode = 0x33; NormalKey = TRUE; break;
|
||||
case '.': MakeCode = 0x34; NormalKey = TRUE; break;
|
||||
case '/': MakeCode = 0x35; NormalKey = TRUE; break;
|
||||
|
||||
case ' ': MakeCode = 0x39; NormalKey = TRUE; break;
|
||||
}
|
||||
if (NormalKey && *OutputBufferSize >= 2)
|
||||
{
|
||||
OutputBuffer[0].MakeCode = MakeCode;
|
||||
OutputBuffer[0].Flags = KEY_MAKE;
|
||||
OutputBuffer[1].MakeCode = MakeCode;
|
||||
OutputBuffer[1].Flags = KEY_BREAK;
|
||||
*BytesConsumed = 2;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Consume strange character by ignoring it */
|
||||
DPRINT1("Green: strange byte received 0x%02x ('%c')\n",
|
||||
*InputBuffer, *InputBuffer >= 32 ? *InputBuffer : '.');
|
||||
*BytesConsumed = 1;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
KeyboardInitialize(
|
||||
IN PDRIVER_OBJECT DriverObject,
|
||||
OUT PDEVICE_OBJECT* KeyboardFdo)
|
||||
{
|
||||
PDEVICE_OBJECT Fdo;
|
||||
PKEYBOARD_DEVICE_EXTENSION DeviceExtension;
|
||||
UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(L"\\Device\\KeyboardClass1");
|
||||
NTSTATUS Status;
|
||||
|
||||
DPRINT("Green: KeyboardInitialize() called\n");
|
||||
|
||||
Status = IoCreateDevice(DriverObject,
|
||||
sizeof(KEYBOARD_DEVICE_EXTENSION),
|
||||
&DeviceName, /* FIXME: don't hardcode string */
|
||||
FILE_DEVICE_KEYBOARD,
|
||||
FILE_DEVICE_SECURE_OPEN,
|
||||
TRUE,
|
||||
&Fdo);
|
||||
if (!NT_SUCCESS(Status))
|
||||
return Status;
|
||||
|
||||
DeviceExtension = (PKEYBOARD_DEVICE_EXTENSION)Fdo->DeviceExtension;
|
||||
RtlZeroMemory(DeviceExtension, sizeof(KEYBOARD_DEVICE_EXTENSION));
|
||||
DeviceExtension->Common.Type = Keyboard;
|
||||
Fdo->Flags |= DO_POWER_PAGABLE | DO_BUFFERED_IO;
|
||||
Fdo->Flags &= ~DO_DEVICE_INITIALIZING;
|
||||
|
||||
*KeyboardFdo = Fdo;
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static VOID STDCALL
|
||||
KeyboardDpcSendData(
|
||||
IN PKDPC Dpc,
|
||||
IN PVOID pDeviceExtension, /* real type PKEYBOARD_DEVICE_EXTENSION */
|
||||
IN PVOID Unused1,
|
||||
IN PVOID Unused2)
|
||||
{
|
||||
PKEYBOARD_DEVICE_EXTENSION DeviceExtension;
|
||||
ULONG Queue;
|
||||
ULONG InputDataConsumed;
|
||||
|
||||
DeviceExtension = (PKEYBOARD_DEVICE_EXTENSION)pDeviceExtension;
|
||||
|
||||
Queue = DeviceExtension->ActiveQueue % 2;
|
||||
InterlockedIncrement((PLONG)&DeviceExtension->ActiveQueue);
|
||||
(*(PSERVICE_CALLBACK_ROUTINE)DeviceExtension->ClassInformation.CallBack)(
|
||||
DeviceExtension->ClassInformation.DeviceObject,
|
||||
DeviceExtension->KeyboardInputData[Queue],
|
||||
&DeviceExtension->KeyboardInputData[Queue][DeviceExtension->InputDataCount[Queue]],
|
||||
&InputDataConsumed);
|
||||
|
||||
DeviceExtension->InputDataCount[Queue] = 0;
|
||||
}
|
||||
static VOID STDCALL
|
||||
KeyboardDeviceWorker(
|
||||
PVOID Context)
|
||||
{
|
||||
PDEVICE_OBJECT DeviceObject;
|
||||
PKEYBOARD_DEVICE_EXTENSION DeviceExtension;
|
||||
PGREEN_DEVICE_EXTENSION GreenDeviceExtension;
|
||||
PDEVICE_OBJECT LowerDevice;
|
||||
UCHAR Buffer[16]; /* Arbitrary size */
|
||||
ULONG BufferSize;
|
||||
PIRP Irp;
|
||||
IO_STATUS_BLOCK ioStatus;
|
||||
KEVENT event;
|
||||
KIRQL OldIrql;
|
||||
ULONG i, Queue;
|
||||
ULONG SpaceInQueue;
|
||||
ULONG BytesConsumed;
|
||||
PKEYBOARD_INPUT_DATA Input;
|
||||
NTSTATUS Status;
|
||||
|
||||
DPRINT("Green: KeyboardDeviceWorker() called\n");
|
||||
|
||||
DeviceObject = (PDEVICE_OBJECT)Context;
|
||||
DeviceExtension = (PKEYBOARD_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
GreenDeviceExtension = (PGREEN_DEVICE_EXTENSION)DeviceExtension->Green->DeviceExtension;
|
||||
LowerDevice = GreenDeviceExtension->Serial;
|
||||
BufferSize = sizeof(Buffer);
|
||||
|
||||
/* Initialize device extension */
|
||||
DeviceExtension->ActiveQueue = 0;
|
||||
DeviceExtension->InputDataCount[0] = 0;
|
||||
DeviceExtension->InputDataCount[1] = 0;
|
||||
KeInitializeDpc(&DeviceExtension->KeyboardDpc, KeyboardDpcSendData, DeviceExtension);
|
||||
RtlZeroMemory(&DeviceExtension->KeyboardInputData, sizeof(DeviceExtension->KeyboardInputData));
|
||||
|
||||
/* main read loop */
|
||||
while (TRUE)
|
||||
{
|
||||
KeInitializeEvent(&event, NotificationEvent, FALSE);
|
||||
Irp = IoBuildSynchronousFsdRequest(
|
||||
IRP_MJ_READ,
|
||||
LowerDevice,
|
||||
Buffer, BufferSize,
|
||||
0,
|
||||
&event,
|
||||
&ioStatus);
|
||||
if (!Irp)
|
||||
{
|
||||
/* no memory actually, try later */
|
||||
CHECKPOINT;
|
||||
KeStallExecutionProcessor(10);
|
||||
continue;
|
||||
}
|
||||
|
||||
Status = IoCallDriver(LowerDevice, Irp);
|
||||
if (Status == STATUS_PENDING)
|
||||
{
|
||||
KeWaitForSingleObject(&event, Suspended, KernelMode, FALSE, NULL);
|
||||
Status = ioStatus.Status;
|
||||
}
|
||||
if (!NT_SUCCESS(Status))
|
||||
continue;
|
||||
|
||||
/* Read all available data and process */
|
||||
i = 0;
|
||||
while (i < ioStatus.Information)
|
||||
{
|
||||
Queue = DeviceExtension->ActiveQueue % 2;
|
||||
|
||||
Input = &DeviceExtension->KeyboardInputData[Queue][DeviceExtension->InputDataCount[Queue]];
|
||||
|
||||
/* Translate current chars to scan codes */
|
||||
SpaceInQueue = KEYBOARD_BUFFER_SIZE - DeviceExtension->InputDataCount[Queue];
|
||||
if (TranslateCharToScanCodes(
|
||||
&Buffer[i], /* input buffer */
|
||||
ioStatus.Information - i, /* input buffer size */
|
||||
Input, /* output buffer */
|
||||
&SpaceInQueue, /* output buffer size */
|
||||
&BytesConsumed)) /* bytes consumed in input buffer */
|
||||
{
|
||||
DPRINT1("Green: got char 0x%02x (%c)\n", Buffer[i], Buffer[i] >= 32 ? Buffer[i] : ' ');
|
||||
DeviceExtension->InputDataCount[Queue] += BytesConsumed;
|
||||
|
||||
/* Send the data to the keyboard class driver */
|
||||
KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
|
||||
KeInsertQueueDpc(&DeviceExtension->KeyboardDpc, NULL, NULL);
|
||||
KeLowerIrql(OldIrql);
|
||||
i += BytesConsumed;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* TranslateCharToScanCodes failed. Possible reasons:
|
||||
* - not enough bytes in input buffer (escape control code; wait next received bytes)
|
||||
* - not enough room in output buffer (wait for the Dpc to empty it)
|
||||
*
|
||||
* The best way to resolve this is to try later.
|
||||
*/
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PsTerminateSystemThread(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
KeyboardInternalDeviceControl(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp)
|
||||
{
|
||||
PIO_STACK_LOCATION Stack;
|
||||
PKEYBOARD_DEVICE_EXTENSION DeviceExtension;
|
||||
PGREEN_DEVICE_EXTENSION GreenDeviceExtension;
|
||||
OBJECT_ATTRIBUTES objectAttributes;
|
||||
PDEVICE_OBJECT LowerDevice;
|
||||
NTSTATUS Status;
|
||||
|
||||
Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||
Irp->IoStatus.Information = 0;
|
||||
DeviceExtension = (PKEYBOARD_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
GreenDeviceExtension = (PGREEN_DEVICE_EXTENSION)DeviceExtension->Green->DeviceExtension;
|
||||
LowerDevice = GreenDeviceExtension->Serial;
|
||||
DPRINT1("Green: LowerDevice %p\n", LowerDevice);
|
||||
|
||||
switch (Stack->Parameters.DeviceIoControl.IoControlCode)
|
||||
{
|
||||
case IOCTL_INTERNAL_KEYBOARD_CONNECT:
|
||||
{
|
||||
ULONG Fcr;
|
||||
|
||||
DPRINT("Green: IRP_MJ_INTERNAL_DEVICE_CONTROL / IOCTL_INTERNAL_KEYBOARD_CONNECT\n");
|
||||
if (Stack->Parameters.DeviceIoControl.InputBufferLength < sizeof(CONNECT_DATA))
|
||||
{
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
break;
|
||||
}
|
||||
|
||||
DeviceExtension->ClassInformation =
|
||||
*((PCLASS_INFORMATION)Stack->Parameters.DeviceIoControl.Type3InputBuffer);
|
||||
|
||||
/* Initialize serial port */
|
||||
Fcr = 0;
|
||||
Status = GreenDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_FIFO_CONTROL,
|
||||
&Fcr, sizeof(Fcr), NULL, NULL);
|
||||
if (!NT_SUCCESS(Status)) break;
|
||||
/* Set serial port speed */
|
||||
Status = GreenDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_BAUD_RATE,
|
||||
&GreenDeviceExtension->BaudRate, sizeof(GreenDeviceExtension->BaudRate), NULL, NULL);
|
||||
if (!NT_SUCCESS(Status)) break;
|
||||
/* Set LCR */
|
||||
Status = GreenDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_LINE_CONTROL,
|
||||
&GreenDeviceExtension->LineControl, sizeof(GreenDeviceExtension->LineControl), NULL, NULL);
|
||||
if (!NT_SUCCESS(Status)) break;
|
||||
|
||||
/* Set timeouts */
|
||||
Status = GreenDeviceIoControl(LowerDevice, IOCTL_SERIAL_SET_TIMEOUTS,
|
||||
&GreenDeviceExtension->Timeouts, sizeof(GreenDeviceExtension->Timeouts), NULL, NULL);
|
||||
if (!NT_SUCCESS(Status)) break;
|
||||
|
||||
/* Start read loop */
|
||||
InitializeObjectAttributes(&objectAttributes, NULL, OBJ_KERNEL_HANDLE, NULL, NULL);
|
||||
Status = PsCreateSystemThread(
|
||||
&DeviceExtension->WorkerThreadHandle,
|
||||
(ACCESS_MASK)0L,
|
||||
&objectAttributes,
|
||||
NULL,
|
||||
NULL,
|
||||
KeyboardDeviceWorker,
|
||||
DeviceObject);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
DPRINT("Green: IRP_MJ_INTERNAL_DEVICE_CONTROL / unknown ioctl code 0x%lx\n",
|
||||
Stack->Parameters.DeviceIoControl.IoControlCode);
|
||||
Status = STATUS_INVALID_DEVICE_REQUEST;
|
||||
}
|
||||
}
|
||||
|
||||
Irp->IoStatus.Status = Status;
|
||||
IoCompleteRequest (Irp, IO_NO_INCREMENT);
|
||||
return Status;
|
||||
}
|
24
reactos/drivers/dd/green/makefile
Normal file
24
reactos/drivers/dd/green/makefile
Normal file
@@ -0,0 +1,24 @@
|
||||
# $Id:
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_BOOTSTRAP = yes
|
||||
|
||||
TARGET_TYPE = driver
|
||||
|
||||
TARGET_NAME = green
|
||||
|
||||
TARGET_CFLAGS = -Wall -Werror -D__USE_W32API
|
||||
|
||||
TARGET_OBJECTS = \
|
||||
$(TARGET_NAME).o \
|
||||
createclose.o \
|
||||
dispatch.o \
|
||||
keyboard.o \
|
||||
misc.o \
|
||||
pnp.o \
|
||||
screen.o
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
60
reactos/drivers/dd/green/misc.c
Normal file
60
reactos/drivers/dd/green/misc.c
Normal file
@@ -0,0 +1,60 @@
|
||||
/* $Id:
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS VT100 emulator
|
||||
* FILE: drivers/dd/green/misc.c
|
||||
* PURPOSE: Misceallenous operations
|
||||
*
|
||||
* PROGRAMMERS: Herv<72> Poussineau (hpoussin@reactos.com)
|
||||
*/
|
||||
|
||||
//#define NDEBUG
|
||||
#include "green.h"
|
||||
|
||||
NTSTATUS
|
||||
GreenDeviceIoControl(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN ULONG CtlCode,
|
||||
IN PVOID InputBuffer OPTIONAL,
|
||||
IN ULONG InputBufferSize,
|
||||
IN OUT PVOID OutputBuffer OPTIONAL,
|
||||
IN OUT PULONG OutputBufferSize)
|
||||
{
|
||||
KEVENT Event;
|
||||
PIRP Irp;
|
||||
IO_STATUS_BLOCK IoStatus;
|
||||
NTSTATUS Status;
|
||||
|
||||
KeInitializeEvent (&Event, NotificationEvent, FALSE);
|
||||
|
||||
Irp = IoBuildDeviceIoControlRequest(CtlCode,
|
||||
DeviceObject,
|
||||
InputBuffer,
|
||||
InputBufferSize,
|
||||
OutputBuffer,
|
||||
(OutputBufferSize) ? *OutputBufferSize : 0,
|
||||
FALSE,
|
||||
&Event,
|
||||
&IoStatus);
|
||||
if (Irp == NULL)
|
||||
{
|
||||
DPRINT("Green: IoBuildDeviceIoControlRequest() failed\n");
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
Status = IoCallDriver(DeviceObject, Irp);
|
||||
|
||||
if (Status == STATUS_PENDING)
|
||||
{
|
||||
DPRINT("Green: Operation pending\n");
|
||||
KeWaitForSingleObject(&Event, Suspended, KernelMode, FALSE, NULL);
|
||||
Status = IoStatus.Status;
|
||||
}
|
||||
|
||||
if (OutputBufferSize)
|
||||
{
|
||||
*OutputBufferSize = IoStatus.Information;
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
87
reactos/drivers/dd/green/pnp.c
Normal file
87
reactos/drivers/dd/green/pnp.c
Normal file
@@ -0,0 +1,87 @@
|
||||
/* $Id:
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS VT100 emulator
|
||||
* FILE: drivers/dd/green/pnp.c
|
||||
* PURPOSE: IRP_MJ_PNP operations
|
||||
*
|
||||
* PROGRAMMERS: Herv<72> Poussineau (hpoussin@reactos.com)
|
||||
*/
|
||||
|
||||
#define NDEBUG
|
||||
#include "green.h"
|
||||
|
||||
NTSTATUS STDCALL
|
||||
GreenAddDevice(
|
||||
IN PDRIVER_OBJECT DriverObject,
|
||||
IN PDEVICE_OBJECT Pdo)
|
||||
{
|
||||
PDEVICE_OBJECT Fdo = NULL;
|
||||
PGREEN_DEVICE_EXTENSION DeviceExtension;
|
||||
UNICODE_STRING serialPortName;
|
||||
NTSTATUS Status;
|
||||
|
||||
DPRINT("Green: AddDevice(DriverObject %p, Pdo %p)\n", DriverObject, Pdo);
|
||||
|
||||
/* Create green FDO */
|
||||
Status = IoCreateDevice(DriverObject,
|
||||
sizeof(GREEN_DEVICE_EXTENSION),
|
||||
NULL,
|
||||
FILE_DEVICE_UNKNOWN,
|
||||
FILE_DEVICE_SECURE_OPEN,
|
||||
TRUE,
|
||||
&Fdo);
|
||||
if (!NT_SUCCESS(Status))
|
||||
return Status;
|
||||
|
||||
DeviceExtension = (PGREEN_DEVICE_EXTENSION)Fdo->DeviceExtension;
|
||||
RtlZeroMemory(DeviceExtension, sizeof(GREEN_DEVICE_EXTENSION));
|
||||
DeviceExtension->Common.Type = Green;
|
||||
|
||||
Status = KeyboardInitialize(DriverObject, &DeviceExtension->Keyboard);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
IoDeleteDevice(Fdo);
|
||||
return Status;
|
||||
}
|
||||
((PKEYBOARD_DEVICE_EXTENSION)DeviceExtension->Keyboard->DeviceExtension)->Green = Fdo;
|
||||
|
||||
Status = ScreenInitialize(DriverObject, &DeviceExtension->Screen);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
IoDeleteDevice(DeviceExtension->Keyboard);
|
||||
IoDeleteDevice(Fdo);
|
||||
return Status;
|
||||
}
|
||||
((PSCREEN_DEVICE_EXTENSION)DeviceExtension->Screen->DeviceExtension)->Green = Fdo;
|
||||
|
||||
/* initialize green Fdo */
|
||||
DeviceExtension->LowerDevice = IoAttachDeviceToDeviceStack(Fdo, Pdo);
|
||||
DeviceExtension->LineControl.WordLength = 8;
|
||||
DeviceExtension->LineControl.Parity = NO_PARITY;
|
||||
DeviceExtension->LineControl.StopBits = STOP_BIT_1;
|
||||
DeviceExtension->BaudRate = SERIAL_BAUD_38400;
|
||||
DeviceExtension->Timeouts.ReadTotalTimeoutConstant = 1; /* not null */
|
||||
DeviceExtension->Timeouts.ReadIntervalTimeout = INFINITE;
|
||||
DeviceExtension->Timeouts.ReadTotalTimeoutMultiplier = INFINITE;
|
||||
DeviceExtension->Timeouts.WriteTotalTimeoutMultiplier = 0; /* FIXME */
|
||||
DeviceExtension->Timeouts.WriteTotalTimeoutConstant = 0; /* FIXME */
|
||||
|
||||
/* open associated serial port */
|
||||
RtlInitUnicodeString(&serialPortName, L"\\Device\\Serial1"); /* FIXME: don't hardcode string */
|
||||
Status = ObReferenceObjectByName(
|
||||
&serialPortName,
|
||||
OBJ_EXCLUSIVE | OBJ_KERNEL_HANDLE,
|
||||
NULL,
|
||||
(ACCESS_MASK)0,
|
||||
IoDeviceObjectType,
|
||||
KernelMode,
|
||||
NULL,
|
||||
(PVOID*)&DeviceExtension->Serial);
|
||||
/* FIXME: we never ObDereferenceObject */
|
||||
|
||||
Fdo->Flags |= DO_POWER_PAGABLE | DO_BUFFERED_IO;
|
||||
Fdo->Flags &= ~DO_DEVICE_INITIALIZING;
|
||||
|
||||
return Status;
|
||||
}
|
544
reactos/drivers/dd/green/screen.c
Normal file
544
reactos/drivers/dd/green/screen.c
Normal file
@@ -0,0 +1,544 @@
|
||||
/* $Id:
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS VT100 emulator
|
||||
* FILE: drivers/dd/green/screen.c
|
||||
* PURPOSE: Screen part of green management
|
||||
*
|
||||
* PROGRAMMERS: Eric Kohl (ekohl@abo.rhein-zeitung.de)
|
||||
* Art Yerkes
|
||||
* Herv<72> Poussineau (hpoussin@reactos.com)
|
||||
*/
|
||||
|
||||
#define NDEBUG
|
||||
#include "green.h"
|
||||
#include <stdarg.h>
|
||||
|
||||
#define ESC ((UCHAR)0x1b)
|
||||
|
||||
/* Force a move of the cursor on each printer char.
|
||||
* Very useful for debug, but it is very slow...
|
||||
*/
|
||||
//#define FORCE_POSITION
|
||||
|
||||
/* UCHAR is promoted to int when passed through '...',
|
||||
* so we get int with va_arg and cast them back to UCHAR.
|
||||
*/
|
||||
static VOID
|
||||
AddToSendBuffer(
|
||||
IN PSCREEN_DEVICE_EXTENSION DeviceExtension,
|
||||
IN ULONG NumberOfChars,
|
||||
... /* IN int */)
|
||||
{
|
||||
PIRP Irp;
|
||||
IO_STATUS_BLOCK ioStatus;
|
||||
va_list args;
|
||||
PDEVICE_OBJECT SerialDevice;
|
||||
ULONG SizeLeft;
|
||||
int CurrentInt;
|
||||
UCHAR CurrentChar;
|
||||
NTSTATUS Status;
|
||||
|
||||
SizeLeft = sizeof(DeviceExtension->SendBuffer) - DeviceExtension->SendBufferPosition;
|
||||
if (SizeLeft < NumberOfChars * 2 || NumberOfChars == 0)
|
||||
{
|
||||
SerialDevice = ((PGREEN_DEVICE_EXTENSION)DeviceExtension->Green->DeviceExtension)->Serial;
|
||||
Irp = IoBuildSynchronousFsdRequest(
|
||||
IRP_MJ_WRITE,
|
||||
SerialDevice,
|
||||
DeviceExtension->SendBuffer, DeviceExtension->SendBufferPosition,
|
||||
NULL, /* StartingOffset */
|
||||
NULL, /* Event */
|
||||
&ioStatus);
|
||||
if (!Irp)
|
||||
{
|
||||
DPRINT1("Green: IoBuildSynchronousFsdRequest() failed. Unable to flush output buffer\n");
|
||||
return;
|
||||
}
|
||||
Status = IoCallDriver(SerialDevice, Irp);
|
||||
if (!NT_SUCCESS(Status) && Status != STATUS_PENDING)
|
||||
{
|
||||
DPRINT1("Green: IoCallDriver() failed. Status = 0x%08lx\n", Status);
|
||||
return;
|
||||
}
|
||||
DeviceExtension->SendBufferPosition = 0;
|
||||
SizeLeft = sizeof(DeviceExtension->SendBuffer);
|
||||
}
|
||||
|
||||
va_start(args, NumberOfChars);
|
||||
while (NumberOfChars-- > 0)
|
||||
{
|
||||
CurrentInt = va_arg(args, int);
|
||||
if (CurrentInt > 0)
|
||||
{
|
||||
CurrentChar = (UCHAR)CurrentInt;
|
||||
|
||||
/* Why 0xff chars are printed on a 'dir' ? */
|
||||
if (CurrentChar == 0xff) CurrentChar = ' ';
|
||||
|
||||
DeviceExtension->SendBuffer[DeviceExtension->SendBufferPosition++] = CurrentChar;
|
||||
SizeLeft--;
|
||||
}
|
||||
else if (CurrentInt == 0)
|
||||
{
|
||||
DeviceExtension->SendBuffer[DeviceExtension->SendBufferPosition++] = '0';
|
||||
SizeLeft--;
|
||||
}
|
||||
else
|
||||
{
|
||||
CurrentInt = -CurrentInt;
|
||||
ASSERT(CurrentInt < 100);
|
||||
if (CurrentInt >= 10)
|
||||
{
|
||||
DeviceExtension->SendBuffer[DeviceExtension->SendBufferPosition++] =
|
||||
(CurrentInt / 10) % 10 + '0';
|
||||
SizeLeft--;
|
||||
}
|
||||
DeviceExtension->SendBuffer[DeviceExtension->SendBufferPosition++] =
|
||||
CurrentInt % 10 + '0';
|
||||
SizeLeft--;
|
||||
}
|
||||
}
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
ScreenInitialize(
|
||||
IN PDRIVER_OBJECT DriverObject,
|
||||
OUT PDEVICE_OBJECT* ScreenFdo)
|
||||
{
|
||||
PDEVICE_OBJECT Fdo;
|
||||
PSCREEN_DEVICE_EXTENSION DeviceExtension;
|
||||
UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(L"\\Device\\BlueScreen");
|
||||
NTSTATUS Status;
|
||||
|
||||
DPRINT("Green: ScreenInitialize() called\n");
|
||||
|
||||
Status = IoCreateDevice(DriverObject,
|
||||
sizeof(SCREEN_DEVICE_EXTENSION),
|
||||
&DeviceName, /* FIXME: don't hardcode string */
|
||||
FILE_DEVICE_SCREEN,
|
||||
FILE_DEVICE_SECURE_OPEN,
|
||||
TRUE,
|
||||
&Fdo);
|
||||
if (!NT_SUCCESS(Status))
|
||||
return Status;
|
||||
|
||||
DeviceExtension = (PSCREEN_DEVICE_EXTENSION)Fdo->DeviceExtension;
|
||||
RtlZeroMemory(DeviceExtension, sizeof(SCREEN_DEVICE_EXTENSION));
|
||||
DeviceExtension->Common.Type = Screen;
|
||||
/* initialize screen */
|
||||
DeviceExtension->Columns = 80;
|
||||
DeviceExtension->Rows = 25;
|
||||
DeviceExtension->ScanLines = 16;
|
||||
DeviceExtension->VideoMemory = (PUCHAR)ExAllocatePool(
|
||||
PagedPool,
|
||||
2 * DeviceExtension->Columns * DeviceExtension->Rows * sizeof(UCHAR));
|
||||
if (!DeviceExtension->VideoMemory)
|
||||
{
|
||||
IoDeleteDevice(Fdo);
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
DeviceExtension->TabWidth = 8;
|
||||
|
||||
/* more initialization */
|
||||
DeviceExtension->Mode = ENABLE_PROCESSED_OUTPUT |
|
||||
ENABLE_WRAP_AT_EOL_OUTPUT;
|
||||
|
||||
/* initialize screen at next write */
|
||||
AddToSendBuffer(DeviceExtension, 2, ESC, 'c'); /* reset device */
|
||||
AddToSendBuffer(DeviceExtension, 4, ESC, '[', '7', 'l'); /* disable line wrap */
|
||||
AddToSendBuffer(DeviceExtension, 4, ESC, '[', '3', 'g'); /* clear all tabs */
|
||||
|
||||
Fdo->Flags |= DO_POWER_PAGABLE | DO_BUFFERED_IO;
|
||||
Fdo->Flags &= ~DO_DEVICE_INITIALIZING;
|
||||
|
||||
*ScreenFdo = Fdo;
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
ScreenWrite(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp)
|
||||
{
|
||||
PIO_STACK_LOCATION Stack;
|
||||
PUCHAR Buffer;
|
||||
PSCREEN_DEVICE_EXTENSION DeviceExtension;
|
||||
PUCHAR VideoMemory; /* FIXME: is it useful? */
|
||||
ULONG VideoMemorySize; /* FIXME: is it useful? */
|
||||
|
||||
ULONG Columns, Rows;
|
||||
ULONG CursorX, CursorY;
|
||||
ULONG i, j;
|
||||
NTSTATUS Status;
|
||||
|
||||
DPRINT("Green: IRP_MJ_WRITE\n");
|
||||
|
||||
Stack = IoGetCurrentIrpStackLocation (Irp);
|
||||
Buffer = Irp->UserBuffer;
|
||||
DeviceExtension = (PSCREEN_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
VideoMemory = DeviceExtension->VideoMemory;
|
||||
|
||||
Columns = DeviceExtension->Columns;
|
||||
Rows = DeviceExtension->Rows;
|
||||
CursorX = (DeviceExtension->LogicalOffset / 2) % Columns + 1;
|
||||
CursorY = (DeviceExtension->LogicalOffset / 2) / Columns + 1;
|
||||
VideoMemorySize = Columns * Rows * 2 * sizeof(UCHAR);
|
||||
DPRINT1("Y: %lu\n", CursorY);
|
||||
DPRINT1("Buffer =");
|
||||
for (i = 0; i < Stack->Parameters.Write.Length; i++)
|
||||
DbgPrint(" 0x%02x", Buffer[i]);
|
||||
DbgPrint("\n");
|
||||
|
||||
if (!(DeviceExtension->Mode & ENABLE_PROCESSED_OUTPUT))
|
||||
{
|
||||
/* raw output mode */
|
||||
CHECKPOINT;
|
||||
Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
|
||||
IoCompleteRequest (Irp, IO_NO_INCREMENT);
|
||||
|
||||
return STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < Stack->Parameters.Write.Length; i++, Buffer++)
|
||||
{
|
||||
switch (*Buffer)
|
||||
{
|
||||
case '\b':
|
||||
{
|
||||
if (CursorX > 1)
|
||||
{
|
||||
CursorX--;
|
||||
AddToSendBuffer(DeviceExtension, 6, ESC, '[', -(int)CursorY, ';', -(int)CursorX, 'H');
|
||||
AddToSendBuffer(DeviceExtension, 1, ' ');
|
||||
AddToSendBuffer(DeviceExtension, 6, ESC, '[', -(int)CursorY, ';', -(int)CursorX, 'H');
|
||||
}
|
||||
else if (CursorY > 1)
|
||||
{
|
||||
CursorX = Columns;
|
||||
CursorY--;
|
||||
AddToSendBuffer(DeviceExtension, 6, ESC, '[', -(int)CursorY, ';', -(int)CursorX, 'H');
|
||||
}
|
||||
break;
|
||||
}
|
||||
case '\n':
|
||||
{
|
||||
CursorY++;
|
||||
CursorX = 1;
|
||||
AddToSendBuffer(DeviceExtension, 6, ESC, '[', -(int)CursorY, ';', '1', 'H');
|
||||
break;
|
||||
}
|
||||
case '\r':
|
||||
{
|
||||
if (CursorX > 1)
|
||||
{
|
||||
AddToSendBuffer(DeviceExtension, 4, ESC, '[', -(int)(CursorX-1), 'D');
|
||||
CursorX = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case '\t':
|
||||
{
|
||||
ULONG Offset = DeviceExtension->TabWidth - (CursorX % DeviceExtension->TabWidth);
|
||||
for (j = 0; j < Offset; j++)
|
||||
{
|
||||
#ifdef FORCE_POSITION
|
||||
AddToSendBuffer(DeviceExtension, 6, ESC, '[', -(int)CursorY, ';', -(int)CursorX, 'H');
|
||||
#endif
|
||||
AddToSendBuffer(DeviceExtension, 1, ' ');
|
||||
CursorX++;
|
||||
if (CursorX > Columns)
|
||||
{
|
||||
CursorX = 1;
|
||||
CursorY++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
#ifdef FORCE_POSITION
|
||||
AddToSendBuffer(DeviceExtension, 6, ESC, '[', -(int)CursorY, ';', -(int)CursorX, 'H');
|
||||
#endif
|
||||
AddToSendBuffer(DeviceExtension, 1, *Buffer);
|
||||
CursorX++;
|
||||
if (CursorX > Columns)
|
||||
{
|
||||
CursorX = 1;
|
||||
DPRINT1("Y: %lu -> %lu\n", CursorY, CursorY + 1);
|
||||
CursorY++;
|
||||
AddToSendBuffer(DeviceExtension, 6, ESC, '[', -(int)CursorY, ';', '1', 'H');
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
if (CursorY > Rows)
|
||||
{
|
||||
DPRINT1("Y: %lu -> %lu\n", CursorY, CursorY - 1);
|
||||
CursorY--;
|
||||
AddToSendBuffer(DeviceExtension, 2, ESC, 'D');
|
||||
AddToSendBuffer(DeviceExtension, 6, ESC, '[', -(int)CursorY, ';', -(int)CursorX, 'H');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DeviceExtension->LogicalOffset = ((CursorX-1) + (CursorY-1) * Columns) * 2;
|
||||
|
||||
/* flush output buffer */
|
||||
AddToSendBuffer(DeviceExtension, 0);
|
||||
|
||||
Status = STATUS_SUCCESS;
|
||||
Irp->IoStatus.Status = Status;
|
||||
IoCompleteRequest (Irp, IO_NO_INCREMENT);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
ScreenDeviceControl(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp)
|
||||
{
|
||||
PIO_STACK_LOCATION Stack;
|
||||
PSCREEN_DEVICE_EXTENSION DeviceExtension;
|
||||
NTSTATUS Status;
|
||||
|
||||
Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||
DeviceExtension = (PSCREEN_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
|
||||
switch (Stack->Parameters.DeviceIoControl.IoControlCode)
|
||||
{
|
||||
case IOCTL_CONSOLE_GET_SCREEN_BUFFER_INFO:
|
||||
{
|
||||
PCONSOLE_SCREEN_BUFFER_INFO pcsbi;
|
||||
DPRINT("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_GET_SCREEN_BUFFER_INFO\n");
|
||||
|
||||
pcsbi = (PCONSOLE_SCREEN_BUFFER_INFO)Irp->AssociatedIrp.SystemBuffer;
|
||||
|
||||
pcsbi->dwSize.X = DeviceExtension->Columns;
|
||||
pcsbi->dwSize.Y = DeviceExtension->Rows;
|
||||
|
||||
pcsbi->dwCursorPosition.X = (SHORT)(DeviceExtension->LogicalOffset % DeviceExtension->Columns);
|
||||
pcsbi->dwCursorPosition.Y = (SHORT)(DeviceExtension->LogicalOffset / DeviceExtension->Columns);
|
||||
|
||||
pcsbi->wAttributes = DeviceExtension->CharAttribute;
|
||||
|
||||
pcsbi->srWindow.Left = 1;
|
||||
pcsbi->srWindow.Right = DeviceExtension->Columns;
|
||||
pcsbi->srWindow.Top = 1;
|
||||
pcsbi->srWindow.Bottom = DeviceExtension->Rows;
|
||||
|
||||
pcsbi->dwMaximumWindowSize.X = DeviceExtension->Columns;
|
||||
pcsbi->dwMaximumWindowSize.Y = DeviceExtension->Rows;
|
||||
|
||||
Irp->IoStatus.Information = sizeof(CONSOLE_SCREEN_BUFFER_INFO);
|
||||
Status = STATUS_SUCCESS;
|
||||
break;
|
||||
}
|
||||
case IOCTL_CONSOLE_SET_SCREEN_BUFFER_INFO:
|
||||
{
|
||||
PCONSOLE_SCREEN_BUFFER_INFO pcsbi;
|
||||
DPRINT("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_SET_SCREEN_BUFFER_INFO\n");
|
||||
|
||||
pcsbi = (PCONSOLE_SCREEN_BUFFER_INFO)Irp->AssociatedIrp.SystemBuffer;
|
||||
/* FIXME: remove */ { pcsbi->dwCursorPosition.X++; }
|
||||
/* FIXME: remove */ { pcsbi->dwCursorPosition.Y++; }
|
||||
ASSERT(pcsbi->dwCursorPosition.X >= 1);
|
||||
ASSERT(pcsbi->dwCursorPosition.Y >= 1);
|
||||
ASSERT(pcsbi->dwCursorPosition.X <= DeviceExtension->Columns);
|
||||
ASSERT(pcsbi->dwCursorPosition.Y <= DeviceExtension->Rows);
|
||||
|
||||
DeviceExtension->LogicalOffset = (
|
||||
(pcsbi->dwCursorPosition.Y-1) * DeviceExtension->Columns +
|
||||
(pcsbi->dwCursorPosition.X-1)) * 2;
|
||||
AddToSendBuffer(DeviceExtension, 6, ESC, '[',
|
||||
-(int)pcsbi->dwCursorPosition.Y, ';',
|
||||
-(int)pcsbi->dwCursorPosition.X, 'H');
|
||||
|
||||
/* flush buffer */
|
||||
AddToSendBuffer(DeviceExtension, 0);
|
||||
|
||||
DeviceExtension->CharAttribute = pcsbi->wAttributes;
|
||||
|
||||
Irp->IoStatus.Information = 0;
|
||||
Status = STATUS_SUCCESS;
|
||||
break;
|
||||
}
|
||||
case IOCTL_CONSOLE_GET_CURSOR_INFO:
|
||||
{
|
||||
PCONSOLE_CURSOR_INFO pcci = (PCONSOLE_CURSOR_INFO)Irp->AssociatedIrp.SystemBuffer;
|
||||
DPRINT("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_GET_CURSOR_INFO\n");
|
||||
|
||||
pcci->dwSize = 1;
|
||||
pcci->bVisible = TRUE;
|
||||
|
||||
Irp->IoStatus.Information = sizeof (CONSOLE_CURSOR_INFO);
|
||||
Status = STATUS_SUCCESS;
|
||||
break;
|
||||
}
|
||||
case IOCTL_CONSOLE_GET_MODE:
|
||||
{
|
||||
PCONSOLE_MODE pcm = (PCONSOLE_MODE)Irp->AssociatedIrp.SystemBuffer;
|
||||
DPRINT("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_GET_MODE\n");
|
||||
|
||||
pcm->dwMode = DeviceExtension->Mode;
|
||||
|
||||
Irp->IoStatus.Information = sizeof(CONSOLE_MODE);
|
||||
Status = STATUS_SUCCESS;
|
||||
break;
|
||||
}
|
||||
case IOCTL_CONSOLE_SET_MODE:
|
||||
{
|
||||
PCONSOLE_MODE pcm = (PCONSOLE_MODE)Irp->AssociatedIrp.SystemBuffer;
|
||||
DPRINT("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_SET_MODE\n");
|
||||
|
||||
DeviceExtension->Mode = pcm->dwMode;
|
||||
|
||||
Irp->IoStatus.Information = 0;
|
||||
Status = STATUS_SUCCESS;
|
||||
break;
|
||||
}
|
||||
case IOCTL_CONSOLE_FILL_OUTPUT_ATTRIBUTE:
|
||||
{
|
||||
DPRINT1("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_FILL_OUTPUT_ATTRIBUTE\n");
|
||||
Status = STATUS_NOT_IMPLEMENTED; /* FIXME: IOCTL_CONSOLE_FILL_OUTPUT_ATTRIBUTE */
|
||||
break;
|
||||
}
|
||||
case IOCTL_CONSOLE_READ_OUTPUT_ATTRIBUTE:
|
||||
{
|
||||
DPRINT1("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_READ_OUTPUT_ATTRIBUTE\n");
|
||||
Status = STATUS_NOT_IMPLEMENTED; /* FIXME: IOCTL_CONSOLE_READ_OUTPUT_ATTRIBUTE */
|
||||
break;
|
||||
}
|
||||
case IOCTL_CONSOLE_WRITE_OUTPUT_ATTRIBUTE:
|
||||
{
|
||||
DPRINT1("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_WRITE_OUTPUT_ATTRIBUTE\n");
|
||||
Status = STATUS_NOT_IMPLEMENTED; /* FIXME: IOCTL_CONSOLE_WRITE_OUTPUT_ATTRIBUTE */
|
||||
break;
|
||||
}
|
||||
case IOCTL_CONSOLE_SET_TEXT_ATTRIBUTE:
|
||||
{
|
||||
DPRINT("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_SET_TEXT_ATTRIBUTE\n");
|
||||
|
||||
DeviceExtension->CharAttribute = (WORD)*(PWORD)Irp->AssociatedIrp.SystemBuffer;
|
||||
Irp->IoStatus.Information = 0;
|
||||
Status = STATUS_SUCCESS;
|
||||
break;
|
||||
}
|
||||
case IOCTL_CONSOLE_FILL_OUTPUT_CHARACTER:
|
||||
{
|
||||
DPRINT1("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_FILL_OUTPUT_CHARACTER\n");
|
||||
Status = STATUS_NOT_IMPLEMENTED; /* FIXME:IOCTL_CONSOLE_FILL_OUTPUT_CHARACTER */
|
||||
break;
|
||||
}
|
||||
case IOCTL_CONSOLE_READ_OUTPUT_CHARACTER:
|
||||
{
|
||||
DPRINT1("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_READ_OUTPUT_CHARACTER\n");
|
||||
Status = STATUS_NOT_IMPLEMENTED; /* FIXME: IOCTL_CONSOLE_READ_OUTPUT_CHARACTER */
|
||||
break;
|
||||
}
|
||||
case IOCTL_CONSOLE_WRITE_OUTPUT_CHARACTER:
|
||||
{
|
||||
DPRINT1("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_WRITE_OUTPUT_CHARACTER\n");
|
||||
Status = STATUS_NOT_IMPLEMENTED; /* FIXME: IOCTL_CONSOLE_WRITE_OUTPUT_CHARACTER */
|
||||
break;
|
||||
}
|
||||
case IOCTL_CONSOLE_DRAW:
|
||||
{
|
||||
PCONSOLE_DRAW ConsoleDraw;
|
||||
PUCHAR Video;
|
||||
ULONG x, y;
|
||||
BOOLEAN DoOptimization = FALSE;
|
||||
DPRINT("Green: IRP_MJ_DEVICE_CONTROL / IOCTL_CONSOLE_DRAW\n");
|
||||
|
||||
ConsoleDraw = (PCONSOLE_DRAW)MmGetSystemAddressForMdl(Irp->MdlAddress);
|
||||
/* FIXME: remove */ { ConsoleDraw->X++; ConsoleDraw->CursorX++; }
|
||||
/* FIXME: remove */ { ConsoleDraw->Y++; ConsoleDraw->CursorY++; }
|
||||
DPRINT1("%lu %lu %lu %lu\n",
|
||||
ConsoleDraw->X, ConsoleDraw->Y,
|
||||
ConsoleDraw->SizeX, ConsoleDraw->SizeY);
|
||||
ASSERT(ConsoleDraw->X >= 1);
|
||||
ASSERT(ConsoleDraw->Y >= 1);
|
||||
ASSERT(ConsoleDraw->X <= DeviceExtension->Columns);
|
||||
ASSERT(ConsoleDraw->Y <= DeviceExtension->Rows);
|
||||
ASSERT(ConsoleDraw->X + ConsoleDraw->SizeX >= 1);
|
||||
ASSERT(ConsoleDraw->Y + ConsoleDraw->SizeY >= 1);
|
||||
ASSERT(ConsoleDraw->X + ConsoleDraw->SizeX - 1 <= DeviceExtension->Columns);
|
||||
ASSERT(ConsoleDraw->Y + ConsoleDraw->SizeY - 1 <= DeviceExtension->Rows);
|
||||
ASSERT(ConsoleDraw->CursorX >= 1);
|
||||
ASSERT(ConsoleDraw->CursorY >= 1);
|
||||
ASSERT(ConsoleDraw->CursorX <= DeviceExtension->Columns);
|
||||
ASSERT(ConsoleDraw->CursorY <= DeviceExtension->Rows);
|
||||
|
||||
#if 0
|
||||
if (ConsoleDraw->X == 1
|
||||
&& ConsoleDraw->Y == 1
|
||||
&& ConsoleDraw->SizeX == DeviceExtension->Columns
|
||||
&& ConsoleDraw->SizeY == DeviceExtension->Rows)
|
||||
{
|
||||
CHECKPOINT1;
|
||||
/* search if we need to clear all screen */
|
||||
DoOptimization = TRUE;
|
||||
Video = (PUCHAR)(ConsoleDraw + 1);
|
||||
x = 0;
|
||||
while (DoOptimization && x < DeviceExtension->Columns * DeviceExtension->Rows)
|
||||
{
|
||||
if (Video[x++] != ' ')
|
||||
{
|
||||
CHECKPOINT1;
|
||||
DoOptimization = FALSE;
|
||||
}
|
||||
/*if (Video[x++] != DeviceExtension->CharAttribute) DoOptimization = FALSE; */
|
||||
}
|
||||
if (DoOptimization)
|
||||
{
|
||||
CHECKPOINT1;
|
||||
AddToSendBuffer(DeviceExtension, 4, ESC, '[', '2', 'J');
|
||||
}
|
||||
}
|
||||
#endif
|
||||
/* add here more optimizations if needed */
|
||||
|
||||
if (!DoOptimization)
|
||||
{
|
||||
for (y = 0; y < ConsoleDraw->SizeY; y++)
|
||||
{
|
||||
AddToSendBuffer(DeviceExtension, 6, ESC, '[',
|
||||
-(int)(ConsoleDraw->Y + y), ';',
|
||||
-(int)(ConsoleDraw->X), 'H');
|
||||
Video = (PUCHAR)(ConsoleDraw + 1);
|
||||
Video = &Video[((ConsoleDraw->Y + y) * DeviceExtension->Columns + ConsoleDraw->X) * 2];
|
||||
for (x = 0; x < ConsoleDraw->SizeX; x++)
|
||||
{
|
||||
AddToSendBuffer(DeviceExtension, 1, Video[x * 2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DeviceExtension->LogicalOffset = (
|
||||
(ConsoleDraw->CursorY-1) * DeviceExtension->Columns +
|
||||
(ConsoleDraw->CursorX-1)) * 2;
|
||||
AddToSendBuffer(DeviceExtension, 6, ESC, '[',
|
||||
-(int)(ConsoleDraw->CursorY), ';',
|
||||
-(int)(ConsoleDraw->CursorX), 'H');
|
||||
|
||||
/* flush buffer */
|
||||
AddToSendBuffer(DeviceExtension, 0);
|
||||
|
||||
Irp->IoStatus.Information = 0;
|
||||
Status = STATUS_SUCCESS;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
DPRINT1("Green: IRP_MJ_DEVICE_CONTROL / unknown ioctl code 0x%lx\n",
|
||||
Stack->Parameters.DeviceIoControl.IoControlCode);
|
||||
Status = STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
Irp->IoStatus.Status = Status;
|
||||
IoCompleteRequest (Irp, IO_NO_INCREMENT);
|
||||
return Status;
|
||||
}
|
@@ -1,96 +1,103 @@
|
||||
/* $Id:
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: drivers/dd/serial/circularbuffer.c
|
||||
* PURPOSE: Operations on a circular buffer
|
||||
*
|
||||
* PROGRAMMERS: Herv<72> Poussineau (poussine@freesurf.fr)
|
||||
*/
|
||||
|
||||
#define NDEBUG
|
||||
#include "serial.h"
|
||||
|
||||
NTSTATUS
|
||||
InitializeCircularBuffer(
|
||||
IN PCIRCULAR_BUFFER pBuffer,
|
||||
IN ULONG BufferSize)
|
||||
{
|
||||
DPRINT("Serial: InitializeCircularBuffer(pBuffer %p, BufferSize %lu)\n", pBuffer, BufferSize);
|
||||
pBuffer->Buffer = (PUCHAR)ExAllocatePoolWithTag(NonPagedPool, BufferSize * sizeof(UCHAR), SERIAL_TAG);
|
||||
if (!pBuffer->Buffer)
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
pBuffer->Length = BufferSize;
|
||||
pBuffer->ReadPosition = pBuffer->WritePosition = 0;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
FreeCircularBuffer(
|
||||
IN PCIRCULAR_BUFFER pBuffer)
|
||||
{
|
||||
DPRINT("Serial: FreeCircularBuffer(pBuffer %p)\n", pBuffer);
|
||||
ExFreePoolWithTag(pBuffer->Buffer, SERIAL_TAG);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
IsCircularBufferEmpty(
|
||||
IN PCIRCULAR_BUFFER pBuffer)
|
||||
{
|
||||
DPRINT("Serial: IsCircularBufferEmpty(pBuffer %p)\n", pBuffer);
|
||||
return (pBuffer->ReadPosition == pBuffer->WritePosition);
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
PushCircularBufferEntry(
|
||||
IN PCIRCULAR_BUFFER pBuffer,
|
||||
IN UCHAR Entry)
|
||||
{
|
||||
DPRINT("Serial: PushCircularBufferEntry(pBuffer %p, Entry 0x%x)\n", pBuffer, Entry);
|
||||
ASSERT(pBuffer->Length);
|
||||
ULONG NextPosition = (pBuffer->WritePosition + 1) % pBuffer->Length;
|
||||
if (NextPosition == pBuffer->ReadPosition)
|
||||
return STATUS_BUFFER_TOO_SMALL;
|
||||
pBuffer->Buffer[pBuffer->WritePosition] = Entry;
|
||||
pBuffer->WritePosition = NextPosition;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
PopCircularBufferEntry(
|
||||
IN PCIRCULAR_BUFFER pBuffer,
|
||||
OUT PUCHAR Entry)
|
||||
{
|
||||
DPRINT("Serial: PopCircularBufferEntry(pBuffer %p)\n", pBuffer);
|
||||
ASSERT(pBuffer->Length);
|
||||
if (IsCircularBufferEmpty(pBuffer))
|
||||
return STATUS_ARRAY_BOUNDS_EXCEEDED;
|
||||
*Entry = pBuffer->Buffer[pBuffer->ReadPosition];
|
||||
pBuffer->ReadPosition = (pBuffer->ReadPosition + 1) % pBuffer->Length;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
IncreaseCircularBufferSize(
|
||||
IN PCIRCULAR_BUFFER pBuffer,
|
||||
IN ULONG NewBufferSize)
|
||||
{
|
||||
PUCHAR NewBuffer;
|
||||
|
||||
DPRINT("Serial: IncreaseCircularBufferSize(pBuffer %p, NewBufferSize %lu)\n", pBuffer, NewBufferSize);
|
||||
ASSERT(pBuffer->Length);
|
||||
if (pBuffer->Length > NewBufferSize)
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
else if (pBuffer->Length == NewBufferSize)
|
||||
return STATUS_SUCCESS;
|
||||
|
||||
NewBuffer = (PUCHAR)ExAllocatePoolWithTag(NonPagedPool, NewBufferSize * sizeof(UCHAR), SERIAL_TAG);
|
||||
if (!NewBuffer)
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
RtlCopyMemory(NewBuffer, pBuffer->Buffer, pBuffer->Length * sizeof(UCHAR));
|
||||
ExFreePoolWithTag(pBuffer->Buffer, SERIAL_TAG);
|
||||
pBuffer->Buffer = NewBuffer;
|
||||
pBuffer->Length = NewBufferSize;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
/* $Id:
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: drivers/dd/serial/circularbuffer.c
|
||||
* PURPOSE: Operations on a circular buffer
|
||||
*
|
||||
* PROGRAMMERS: Herv<72> Poussineau (poussine@freesurf.fr)
|
||||
*/
|
||||
|
||||
#define NDEBUG
|
||||
#include "serial.h"
|
||||
|
||||
NTSTATUS
|
||||
InitializeCircularBuffer(
|
||||
IN PCIRCULAR_BUFFER pBuffer,
|
||||
IN ULONG BufferSize)
|
||||
{
|
||||
DPRINT("Serial: InitializeCircularBuffer(pBuffer %p, BufferSize %lu)\n", pBuffer, BufferSize);
|
||||
ASSERT(pBuffer);
|
||||
pBuffer->Buffer = (PUCHAR)ExAllocatePoolWithTag(NonPagedPool, BufferSize * sizeof(UCHAR), SERIAL_TAG);
|
||||
if (!pBuffer->Buffer)
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
pBuffer->Length = BufferSize;
|
||||
pBuffer->ReadPosition = pBuffer->WritePosition = 0;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
FreeCircularBuffer(
|
||||
IN PCIRCULAR_BUFFER pBuffer)
|
||||
{
|
||||
DPRINT("Serial: FreeCircularBuffer(pBuffer %p)\n", pBuffer);
|
||||
ASSERT(pBuffer);
|
||||
ExFreePoolWithTag(pBuffer->Buffer, SERIAL_TAG);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
IsCircularBufferEmpty(
|
||||
IN PCIRCULAR_BUFFER pBuffer)
|
||||
{
|
||||
DPRINT("Serial: IsCircularBufferEmpty(pBuffer %p)\n", pBuffer);
|
||||
ASSERT(pBuffer);
|
||||
return (pBuffer->ReadPosition == pBuffer->WritePosition);
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
PushCircularBufferEntry(
|
||||
IN PCIRCULAR_BUFFER pBuffer,
|
||||
IN UCHAR Entry)
|
||||
{
|
||||
ULONG NextPosition;
|
||||
DPRINT("Serial: PushCircularBufferEntry(pBuffer %p, Entry 0x%x)\n", pBuffer, Entry);
|
||||
ASSERT(pBuffer);
|
||||
ASSERT(pBuffer->Length);
|
||||
NextPosition = (pBuffer->WritePosition + 1) % pBuffer->Length;
|
||||
if (NextPosition == pBuffer->ReadPosition)
|
||||
return STATUS_BUFFER_TOO_SMALL;
|
||||
pBuffer->Buffer[pBuffer->WritePosition] = Entry;
|
||||
pBuffer->WritePosition = NextPosition;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
PopCircularBufferEntry(
|
||||
IN PCIRCULAR_BUFFER pBuffer,
|
||||
OUT PUCHAR Entry)
|
||||
{
|
||||
DPRINT("Serial: PopCircularBufferEntry(pBuffer %p)\n", pBuffer);
|
||||
ASSERT(pBuffer);
|
||||
ASSERT(pBuffer->Length);
|
||||
if (IsCircularBufferEmpty(pBuffer))
|
||||
return STATUS_ARRAY_BOUNDS_EXCEEDED;
|
||||
*Entry = pBuffer->Buffer[pBuffer->ReadPosition];
|
||||
pBuffer->ReadPosition = (pBuffer->ReadPosition + 1) % pBuffer->Length;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
IncreaseCircularBufferSize(
|
||||
IN PCIRCULAR_BUFFER pBuffer,
|
||||
IN ULONG NewBufferSize)
|
||||
{
|
||||
PUCHAR NewBuffer;
|
||||
|
||||
DPRINT("Serial: IncreaseCircularBufferSize(pBuffer %p, NewBufferSize %lu)\n", pBuffer, NewBufferSize);
|
||||
ASSERT(pBuffer);
|
||||
ASSERT(pBuffer->Length);
|
||||
if (pBuffer->Length > NewBufferSize)
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
else if (pBuffer->Length == NewBufferSize)
|
||||
return STATUS_SUCCESS;
|
||||
|
||||
NewBuffer = (PUCHAR)ExAllocatePoolWithTag(NonPagedPool, NewBufferSize * sizeof(UCHAR), SERIAL_TAG);
|
||||
if (!NewBuffer)
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
RtlCopyMemory(NewBuffer, pBuffer->Buffer, pBuffer->Length * sizeof(UCHAR));
|
||||
ExFreePoolWithTag(pBuffer->Buffer, SERIAL_TAG);
|
||||
pBuffer->Buffer = NewBuffer;
|
||||
pBuffer->Length = NewBufferSize;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
@@ -26,6 +26,8 @@ SerialCreate(
|
||||
FileObject = Stack->FileObject;
|
||||
DeviceExtension = (PSERIAL_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
|
||||
ASSERT(FileObject);
|
||||
|
||||
if (Stack->Parameters.Create.Options & FILE_DIRECTORY_FILE)
|
||||
{
|
||||
CHECKPOINT;
|
||||
|
@@ -7,11 +7,42 @@
|
||||
*
|
||||
* PROGRAMMERS: Herv<72> Poussineau (poussine@freesurf.fr)
|
||||
*/
|
||||
/* FIXME: call IoAcquireRemoveLock/IoReleaseRemoveLock around each I/O operation */
|
||||
|
||||
#define NDEBUG
|
||||
#include "serial.h"
|
||||
|
||||
#define IO_METHOD_FROM_CTL_CODE(ctlCode) (ctlCode&0x00000003)
|
||||
|
||||
static VOID
|
||||
SerialGetUserBuffers(
|
||||
IN PIRP Irp,
|
||||
IN ULONG IoControlCode,
|
||||
OUT PVOID* BufferIn,
|
||||
OUT PVOID* BufferOut)
|
||||
{
|
||||
ASSERT(Irp);
|
||||
ASSERT(BufferIn);
|
||||
ASSERT(BufferOut);
|
||||
|
||||
switch (IO_METHOD_FROM_CTL_CODE(IoControlCode))
|
||||
{
|
||||
case METHOD_BUFFERED:
|
||||
*BufferIn = *BufferOut = Irp->AssociatedIrp.SystemBuffer;
|
||||
return;
|
||||
case METHOD_IN_DIRECT:
|
||||
case METHOD_OUT_DIRECT:
|
||||
*BufferIn = Irp->AssociatedIrp.SystemBuffer;
|
||||
*BufferOut = MmGetSystemAddressForMdl(Irp->MdlAddress);
|
||||
return;
|
||||
case METHOD_NEITHER:
|
||||
*BufferIn = IoGetCurrentIrpStackLocation(Irp)->Parameters.DeviceIoControl.Type3InputBuffer;
|
||||
*BufferOut = Irp->UserBuffer;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Should never happen */
|
||||
}
|
||||
|
||||
NTSTATUS STDCALL
|
||||
SerialSetBaudRate(
|
||||
IN PSERIAL_DEVICE_EXTENSION DeviceExtension,
|
||||
@@ -87,6 +118,9 @@ SerialSetLineControl(
|
||||
UCHAR Lcr = 0;
|
||||
NTSTATUS Status;
|
||||
|
||||
ASSERT(DeviceExtension);
|
||||
ASSERT(NewSettings);
|
||||
|
||||
DPRINT("Serial: SerialSetLineControl(COM%lu, Settings { %lu %lu %lu })\n",
|
||||
DeviceExtension->ComPort, NewSettings->StopBits, NewSettings->Parity, NewSettings->WordLength);
|
||||
|
||||
@@ -151,9 +185,12 @@ SerialSetLineControl(
|
||||
|
||||
BOOLEAN
|
||||
SerialClearPerfStats(
|
||||
IN PSERIALPERF_STATS pSerialPerfStats)
|
||||
IN PSERIAL_DEVICE_EXTENSION DeviceExtension)
|
||||
{
|
||||
RtlZeroMemory(pSerialPerfStats, sizeof(SERIALPERF_STATS));
|
||||
ASSERT(DeviceExtension);
|
||||
|
||||
RtlZeroMemory(&DeviceExtension->SerialPerfStats, sizeof(SERIALPERF_STATS));
|
||||
DeviceExtension->BreakInterruptErrorCount = 0;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -163,6 +200,7 @@ SerialGetPerfStats(IN PIRP pIrp)
|
||||
PSERIAL_DEVICE_EXTENSION pDeviceExtension;
|
||||
pDeviceExtension = (PSERIAL_DEVICE_EXTENSION)
|
||||
IoGetCurrentIrpStackLocation(pIrp)->DeviceObject->DeviceExtension;
|
||||
ASSERT(DeviceExtension);
|
||||
/*
|
||||
* we assume buffer is big enough to hold SerialPerfStats structure
|
||||
* caller must verify this
|
||||
@@ -180,6 +218,8 @@ SerialGetCommProp(
|
||||
OUT PSERIAL_COMMPROP pCommProp,
|
||||
IN PSERIAL_DEVICE_EXTENSION DeviceExtension)
|
||||
{
|
||||
ASSERT(pCommProp);
|
||||
|
||||
RtlZeroMemory(pCommProp, sizeof(SERIAL_COMMPROP));
|
||||
|
||||
pCommProp->PacketLength = sizeof(SERIAL_COMMPROP);
|
||||
@@ -187,22 +227,30 @@ SerialGetCommProp(
|
||||
pCommProp->ServiceMask = SERIAL_SP_SERIALCOMM;
|
||||
pCommProp->MaxTxQueue = pCommProp->CurrentTxQueue = DeviceExtension->OutputBuffer.Length - 1;
|
||||
pCommProp->MaxRxQueue = pCommProp->CurrentRxQueue = DeviceExtension->InputBuffer.Length - 1;
|
||||
pCommProp->MaxBaud = SERIAL_BAUD_115200;
|
||||
pCommProp->ProvSubType = 1; // PST_RS232;
|
||||
/* FIXME: ProvCapabilities may be related to Uart type */
|
||||
pCommProp->ProvCapabilities = SERIAL_PCF_DTRDSR | SERIAL_PCF_INTTIMEOUTS | SERIAL_PCF_PARITY_CHECK
|
||||
| SERIAL_PCF_RTSCTS | SERIAL_PCF_SETXCHAR | SERIAL_PCF_SPECIALCHARS | SERIAL_PCF_TOTALTIMEOUTS
|
||||
| SERIAL_PCF_XONXOFF;
|
||||
/* FIXME: SettableParams may be related to Uart type */
|
||||
pCommProp->SettableParams = SERIAL_SP_BAUD | SERIAL_SP_DATABITS | SERIAL_SP_HANDSHAKING
|
||||
| SERIAL_SP_PARITY | SERIAL_SP_PARITY_CHECK | SERIAL_SP_STOPBITS;
|
||||
/* FIXME: SettableBaud may be related to Uart type */
|
||||
|
||||
/* SettableBaud is related to Uart type */
|
||||
pCommProp->SettableBaud = SERIAL_BAUD_075 | SERIAL_BAUD_110 | SERIAL_BAUD_134_5
|
||||
| SERIAL_BAUD_150 | SERIAL_BAUD_300 | SERIAL_BAUD_600 | SERIAL_BAUD_1200
|
||||
| SERIAL_BAUD_1800 | SERIAL_BAUD_2400 | SERIAL_BAUD_4800 | SERIAL_BAUD_7200
|
||||
| SERIAL_BAUD_9600 | SERIAL_BAUD_14400 | SERIAL_BAUD_19200 | SERIAL_BAUD_38400
|
||||
| SERIAL_BAUD_56K | SERIAL_BAUD_57600 | SERIAL_BAUD_115200 | SERIAL_BAUD_128K
|
||||
| SERIAL_BAUD_USER;
|
||||
| SERIAL_BAUD_9600 | SERIAL_BAUD_USER;
|
||||
pCommProp->MaxBaud = SERIAL_BAUD_9600;
|
||||
if (DeviceExtension->UartType >= Uart16450)
|
||||
{
|
||||
pCommProp->SettableBaud |= SERIAL_BAUD_14400 | SERIAL_BAUD_19200 | SERIAL_BAUD_38400;
|
||||
pCommProp->MaxBaud = SERIAL_BAUD_38400;
|
||||
}
|
||||
if (DeviceExtension->UartType >= Uart16550)
|
||||
{
|
||||
pCommProp->SettableBaud |= SERIAL_BAUD_56K | SERIAL_BAUD_57600 | SERIAL_BAUD_115200 | SERIAL_BAUD_128K;
|
||||
pCommProp->MaxBaud = SERIAL_BAUD_115200;
|
||||
}
|
||||
|
||||
pCommProp->SettableData = SERIAL_DATABITS_5 | SERIAL_DATABITS_6 | SERIAL_DATABITS_7 | SERIAL_DATABITS_8;
|
||||
pCommProp->SettableStopParity = SERIAL_STOPBITS_10 | SERIAL_STOPBITS_15 | SERIAL_STOPBITS_20
|
||||
| SERIAL_PARITY_NONE | SERIAL_PARITY_ODD | SERIAL_PARITY_EVEN | SERIAL_PARITY_MARK | SERIAL_PARITY_SPACE;
|
||||
@@ -217,9 +265,21 @@ SerialGetCommStatus(
|
||||
{
|
||||
KIRQL Irql;
|
||||
|
||||
ASSERT(pSerialStatus);
|
||||
RtlZeroMemory(pSerialStatus, sizeof(SERIAL_STATUS));
|
||||
|
||||
pSerialStatus->Errors = 0; /* FIXME */
|
||||
pSerialStatus->Errors = 0;
|
||||
if (DeviceExtension->BreakInterruptErrorCount)
|
||||
pSerialStatus->Errors |= SERIAL_ERROR_BREAK;
|
||||
if (DeviceExtension->SerialPerfStats.FrameErrorCount)
|
||||
pSerialStatus->Errors |= SERIAL_ERROR_FRAMING;
|
||||
if (DeviceExtension->SerialPerfStats.SerialOverrunErrorCount)
|
||||
pSerialStatus->Errors |= SERIAL_ERROR_OVERRUN;
|
||||
if (DeviceExtension->SerialPerfStats.BufferOverrunErrorCount)
|
||||
pSerialStatus->Errors |= SERIAL_ERROR_QUEUEOVERRUN;
|
||||
if (DeviceExtension->SerialPerfStats.ParityErrorCount)
|
||||
pSerialStatus->Errors |= SERIAL_ERROR_PARITY;
|
||||
|
||||
pSerialStatus->HoldReasons = 0; /* FIXME */
|
||||
|
||||
KeAcquireSpinLock(&DeviceExtension->InputBufferLock, &Irql);
|
||||
@@ -232,8 +292,8 @@ SerialGetCommStatus(
|
||||
- DeviceExtension->OutputBuffer.ReadPosition) % DeviceExtension->OutputBuffer.Length;
|
||||
KeReleaseSpinLock(&DeviceExtension->OutputBufferLock, Irql);
|
||||
|
||||
pSerialStatus->EofReceived = FALSE; /* FIXME */
|
||||
pSerialStatus->WaitForImmediate = FALSE; /* FIXME */
|
||||
pSerialStatus->EofReceived = FALSE; /* always FALSE */
|
||||
pSerialStatus->WaitForImmediate = FALSE; /* always FALSE */
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
@@ -244,27 +304,27 @@ SerialDeviceControl(
|
||||
IN PIRP Irp)
|
||||
{
|
||||
PIO_STACK_LOCATION Stack;
|
||||
ULONG IoControlCode;
|
||||
PSERIAL_DEVICE_EXTENSION DeviceExtension;
|
||||
ULONG LengthIn, LengthOut;
|
||||
ULONG Information = 0;
|
||||
PUCHAR Buffer;
|
||||
ULONG_PTR Information = 0;
|
||||
PVOID BufferIn, BufferOut;
|
||||
PUCHAR ComPortBase;
|
||||
NTSTATUS Status;
|
||||
|
||||
DPRINT("Serial: IRP_MJ_DEVICE_CONTROL dispatch\n");
|
||||
|
||||
/* FIXME: pend operation if possible */
|
||||
|
||||
Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||
LengthIn = Stack->Parameters.DeviceIoControl.InputBufferLength;
|
||||
LengthOut = Stack->Parameters.DeviceIoControl.OutputBufferLength;
|
||||
Buffer = Irp->AssociatedIrp.SystemBuffer;
|
||||
DeviceExtension = (PSERIAL_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
ComPortBase = (PUCHAR)DeviceExtension->BaseAddress;
|
||||
IoControlCode = Stack->Parameters.DeviceIoControl.IoControlCode;
|
||||
SerialGetUserBuffers(Irp, IoControlCode, &BufferIn, &BufferOut);
|
||||
|
||||
/* FIXME: need to probe buffers */
|
||||
/* FIXME: see http://www.osronline.com/ddkx/serial/serref_61bm.htm */
|
||||
switch (Stack->Parameters.DeviceIoControl.IoControlCode)
|
||||
switch (IoControlCode)
|
||||
{
|
||||
case IOCTL_SERIAL_CLEAR_STATS:
|
||||
{
|
||||
@@ -272,7 +332,7 @@ SerialDeviceControl(
|
||||
KeSynchronizeExecution(
|
||||
DeviceExtension->Interrupt,
|
||||
(PKSYNCHRONIZE_ROUTINE)SerialClearPerfStats,
|
||||
&DeviceExtension->SerialPerfStats);
|
||||
DeviceExtension);
|
||||
Status = STATUS_SUCCESS;
|
||||
break;
|
||||
}
|
||||
@@ -281,9 +341,13 @@ SerialDeviceControl(
|
||||
DPRINT("Serial: IOCTL_SERIAL_CLR_DTR\n");
|
||||
/* FIXME: If the handshake flow control of the device is configured to
|
||||
* automatically use DTR, return STATUS_INVALID_PARAMETER */
|
||||
DeviceExtension->MCR &= ~SR_MCR_DTR;
|
||||
WRITE_PORT_UCHAR(SER_MCR(ComPortBase), DeviceExtension->MCR);
|
||||
Status = STATUS_SUCCESS;
|
||||
Status = IoAcquireRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
DeviceExtension->MCR &= ~SR_MCR_DTR;
|
||||
WRITE_PORT_UCHAR(SER_MCR(ComPortBase), DeviceExtension->MCR);
|
||||
IoReleaseRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case IOCTL_SERIAL_CLR_RTS:
|
||||
@@ -291,9 +355,13 @@ SerialDeviceControl(
|
||||
DPRINT("Serial: IOCTL_SERIAL_CLR_RTS\n");
|
||||
/* FIXME: If the handshake flow control of the device is configured to
|
||||
* automatically use RTS, return STATUS_INVALID_PARAMETER */
|
||||
DeviceExtension->MCR &= ~SR_MCR_RTS;
|
||||
WRITE_PORT_UCHAR(SER_MCR(ComPortBase), DeviceExtension->MCR);
|
||||
Status = STATUS_SUCCESS;
|
||||
Status = IoAcquireRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
DeviceExtension->MCR &= ~SR_MCR_RTS;
|
||||
WRITE_PORT_UCHAR(SER_MCR(ComPortBase), DeviceExtension->MCR);
|
||||
IoReleaseRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case IOCTL_SERIAL_CONFIG_SIZE:
|
||||
@@ -301,11 +369,11 @@ SerialDeviceControl(
|
||||
/* Obsolete on Microsoft Windows 2000+ */
|
||||
PULONG pConfigSize;
|
||||
DPRINT("Serial: IOCTL_SERIAL_CONFIG_SIZE\n");
|
||||
if (LengthOut != sizeof(ULONG) || Buffer == NULL)
|
||||
if (LengthOut != sizeof(ULONG) || BufferOut == NULL)
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
else
|
||||
{
|
||||
pConfigSize = (PULONG)Buffer;
|
||||
pConfigSize = (PULONG)BufferOut;
|
||||
*pConfigSize = 0;
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
@@ -314,18 +382,17 @@ SerialDeviceControl(
|
||||
case IOCTL_SERIAL_GET_BAUD_RATE:
|
||||
{
|
||||
DPRINT("Serial: IOCTL_SERIAL_GET_BAUD_RATE\n");
|
||||
/* FIXME: HACK!!! following line MUST NOT be here! */
|
||||
Buffer = Irp->UserBuffer;
|
||||
if (LengthOut < sizeof(SERIAL_BAUD_RATE))
|
||||
Status = STATUS_BUFFER_TOO_SMALL;
|
||||
else if (Buffer == NULL)
|
||||
else if (BufferOut == NULL)
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
else
|
||||
{
|
||||
((PSERIAL_BAUD_RATE)Buffer)->BaudRate = DeviceExtension->BaudRate;
|
||||
((PSERIAL_BAUD_RATE)BufferOut)->BaudRate = DeviceExtension->BaudRate;
|
||||
Information = sizeof(SERIAL_BAUD_RATE);
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case IOCTL_SERIAL_GET_CHARS:
|
||||
{
|
||||
@@ -342,14 +409,14 @@ SerialDeviceControl(
|
||||
DPRINT("Serial: return STATUS_BUFFER_TOO_SMALL\n");
|
||||
Status = STATUS_BUFFER_TOO_SMALL;
|
||||
}
|
||||
else if (Buffer == NULL)
|
||||
else if (BufferOut == NULL)
|
||||
{
|
||||
DPRINT("Serial: return STATUS_INVALID_PARAMETER\n");
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
else
|
||||
{
|
||||
Status = SerialGetCommStatus((PSERIAL_STATUS)Buffer, DeviceExtension);
|
||||
Status = SerialGetCommStatus((PSERIAL_STATUS)BufferOut, DeviceExtension);
|
||||
Information = sizeof(SERIAL_STATUS);
|
||||
}
|
||||
break;
|
||||
@@ -358,11 +425,11 @@ SerialDeviceControl(
|
||||
{
|
||||
PULONG pDtrRts;
|
||||
DPRINT("Serial: IOCTL_SERIAL_GET_DTRRTS\n");
|
||||
if (LengthOut != sizeof(ULONG) || Buffer == NULL)
|
||||
if (LengthOut != sizeof(ULONG) || BufferOut == NULL)
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
else
|
||||
{
|
||||
pDtrRts = (PULONG)Buffer;
|
||||
pDtrRts = (PULONG)BufferOut;
|
||||
*pDtrRts = 0;
|
||||
if (DeviceExtension->MCR & SR_MCR_DTR)
|
||||
*pDtrRts |= SERIAL_DTR_STATE;
|
||||
@@ -384,11 +451,11 @@ SerialDeviceControl(
|
||||
DPRINT("Serial: IOCTL_SERIAL_GET_LINE_CONTROL\n");
|
||||
if (LengthOut < sizeof(SERIAL_LINE_CONTROL))
|
||||
Status = STATUS_BUFFER_TOO_SMALL;
|
||||
else if (Buffer == NULL)
|
||||
else if (BufferOut == NULL)
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
else
|
||||
{
|
||||
*((PSERIAL_LINE_CONTROL)Buffer) = DeviceExtension->SerialLineControl;
|
||||
*((PSERIAL_LINE_CONTROL)BufferOut) = DeviceExtension->SerialLineControl;
|
||||
Information = sizeof(SERIAL_LINE_CONTROL);
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
@@ -398,11 +465,11 @@ SerialDeviceControl(
|
||||
{
|
||||
PULONG pMCR;
|
||||
DPRINT("Serial: IOCTL_SERIAL_GET_MODEM_CONTROL\n");
|
||||
if (LengthOut != sizeof(ULONG) || Buffer == NULL)
|
||||
if (LengthOut != sizeof(ULONG) || BufferOut == NULL)
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
else
|
||||
{
|
||||
pMCR = (PULONG)Buffer;
|
||||
pMCR = (PULONG)BufferOut;
|
||||
*pMCR = DeviceExtension->MCR;
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
@@ -412,11 +479,11 @@ SerialDeviceControl(
|
||||
{
|
||||
PULONG pMSR;
|
||||
DPRINT("Serial: IOCTL_SERIAL_GET_MODEMSTATUS\n");
|
||||
if (LengthOut != sizeof(ULONG) || Buffer == NULL)
|
||||
if (LengthOut != sizeof(ULONG) || BufferOut == NULL)
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
else
|
||||
{
|
||||
pMSR = (PULONG)Buffer;
|
||||
pMSR = (PULONG)BufferOut;
|
||||
*pMSR = DeviceExtension->MSR;
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
@@ -430,14 +497,14 @@ SerialDeviceControl(
|
||||
DPRINT("Serial: return STATUS_BUFFER_TOO_SMALL\n");
|
||||
Status = STATUS_BUFFER_TOO_SMALL;
|
||||
}
|
||||
else if (Buffer == NULL)
|
||||
else if (BufferOut == NULL)
|
||||
{
|
||||
DPRINT("Serial: return STATUS_INVALID_PARAMETER\n");
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
else
|
||||
{
|
||||
Status = SerialGetCommProp((PSERIAL_COMMPROP)Buffer, DeviceExtension);
|
||||
Status = SerialGetCommProp((PSERIAL_COMMPROP)BufferOut, DeviceExtension);
|
||||
Information = sizeof(SERIAL_COMMPROP);
|
||||
}
|
||||
break;
|
||||
@@ -450,7 +517,7 @@ SerialDeviceControl(
|
||||
DPRINT("Serial: return STATUS_BUFFER_TOO_SMALL\n");
|
||||
Status = STATUS_BUFFER_TOO_SMALL;
|
||||
}
|
||||
else if (Buffer == NULL)
|
||||
else if (BufferOut == NULL)
|
||||
{
|
||||
DPRINT("Serial: return STATUS_INVALID_PARAMETER\n");
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
@@ -467,11 +534,11 @@ SerialDeviceControl(
|
||||
case IOCTL_SERIAL_GET_TIMEOUTS:
|
||||
{
|
||||
DPRINT("Serial: IOCTL_SERIAL_GET_TIMEOUTS\n");
|
||||
if (LengthOut != sizeof(SERIAL_TIMEOUTS) || Buffer == NULL)
|
||||
if (LengthOut != sizeof(SERIAL_TIMEOUTS) || BufferOut == NULL)
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
else
|
||||
{
|
||||
*(PSERIAL_TIMEOUTS)Buffer = DeviceExtension->SerialTimeOuts;
|
||||
*(PSERIAL_TIMEOUTS)BufferOut = DeviceExtension->SerialTimeOuts;
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
break;
|
||||
@@ -480,11 +547,11 @@ SerialDeviceControl(
|
||||
{
|
||||
PULONG pWaitMask;
|
||||
DPRINT("Serial: IOCTL_SERIAL_GET_WAIT_MASK\n");
|
||||
if (LengthOut != sizeof(ULONG) || Buffer == NULL)
|
||||
if (LengthOut != sizeof(ULONG) || BufferOut == NULL)
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
else
|
||||
{
|
||||
pWaitMask = (PULONG)Buffer;
|
||||
pWaitMask = (PULONG)BufferOut;
|
||||
*pWaitMask = DeviceExtension->WaitMask;
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
@@ -506,21 +573,52 @@ SerialDeviceControl(
|
||||
}
|
||||
case IOCTL_SERIAL_PURGE:
|
||||
{
|
||||
KIRQL Irql1, Irql2;
|
||||
KIRQL Irql;
|
||||
DPRINT("Serial: IOCTL_SERIAL_PURGE\n");
|
||||
KeAcquireSpinLock(&DeviceExtension->InputBufferLock, &Irql1);
|
||||
KeAcquireSpinLock(&DeviceExtension->OutputBufferLock, &Irql2);
|
||||
DeviceExtension->InputBuffer.ReadPosition = DeviceExtension->InputBuffer.WritePosition = 0;
|
||||
DeviceExtension->OutputBuffer.ReadPosition = DeviceExtension->OutputBuffer.WritePosition = 0;
|
||||
/* Clear receive/transmit buffers */
|
||||
if (DeviceExtension->UartType >= Uart16550)
|
||||
/* FIXME: SERIAL_PURGE_RXABORT and SERIAL_PURGE_TXABORT
|
||||
* should stop current request */
|
||||
if (LengthIn != sizeof(ULONG) || BufferIn == NULL)
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
else
|
||||
{
|
||||
WRITE_PORT_UCHAR(SER_FCR(ComPortBase),
|
||||
SR_FCR_CLEAR_RCVR | SR_FCR_CLEAR_XMIT);
|
||||
ULONG PurgeMask = *(PULONG)BufferIn;
|
||||
|
||||
Status = STATUS_SUCCESS;
|
||||
/* FIXME: use SERIAL_PURGE_RXABORT and SERIAL_PURGE_TXABORT flags */
|
||||
if (PurgeMask & SERIAL_PURGE_RXCLEAR)
|
||||
{
|
||||
KeAcquireSpinLock(&DeviceExtension->InputBufferLock, &Irql);
|
||||
DeviceExtension->InputBuffer.ReadPosition = DeviceExtension->InputBuffer.WritePosition = 0;
|
||||
if (DeviceExtension->UartType >= Uart16550A)
|
||||
{
|
||||
/* Clear also Uart FIFO */
|
||||
Status = IoAcquireRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
WRITE_PORT_UCHAR(SER_FCR(ComPortBase), SR_FCR_CLEAR_RCVR);
|
||||
IoReleaseRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
|
||||
}
|
||||
}
|
||||
KeReleaseSpinLock(&DeviceExtension->InputBufferLock, Irql);
|
||||
}
|
||||
|
||||
if (PurgeMask & SERIAL_PURGE_TXCLEAR)
|
||||
{
|
||||
KeAcquireSpinLock(&DeviceExtension->OutputBufferLock, &Irql);
|
||||
DeviceExtension->OutputBuffer.ReadPosition = DeviceExtension->OutputBuffer.WritePosition = 0;
|
||||
if (DeviceExtension->UartType >= Uart16550A)
|
||||
{
|
||||
/* Clear also Uart FIFO */
|
||||
Status = IoAcquireRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
WRITE_PORT_UCHAR(SER_FCR(ComPortBase), SR_FCR_CLEAR_XMIT);
|
||||
IoReleaseRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
|
||||
}
|
||||
}
|
||||
KeReleaseSpinLock(&DeviceExtension->OutputBufferLock, Irql);
|
||||
}
|
||||
}
|
||||
KeReleaseSpinLock(&DeviceExtension->OutputBufferLock, Irql2);
|
||||
KeReleaseSpinLock(&DeviceExtension->InputBufferLock, Irql1);
|
||||
Status = STATUS_SUCCESS;
|
||||
break;
|
||||
}
|
||||
case IOCTL_SERIAL_RESET_DEVICE:
|
||||
@@ -534,11 +632,11 @@ SerialDeviceControl(
|
||||
{
|
||||
PULONG pNewBaudRate;
|
||||
DPRINT("Serial: IOCTL_SERIAL_SET_BAUD_RATE\n");
|
||||
if (LengthIn != sizeof(ULONG) || Buffer == NULL)
|
||||
if (LengthIn != sizeof(ULONG) || BufferIn == NULL)
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
else
|
||||
{
|
||||
pNewBaudRate = (PULONG)Buffer;
|
||||
pNewBaudRate = (PULONG)BufferIn;
|
||||
Status = SerialSetBaudRate(DeviceExtension, *pNewBaudRate);
|
||||
}
|
||||
break;
|
||||
@@ -571,21 +669,31 @@ SerialDeviceControl(
|
||||
DPRINT("Serial: IOCTL_SERIAL_SET_DTR\n");
|
||||
if (!(DeviceExtension->MCR & SR_MCR_DTR))
|
||||
{
|
||||
DeviceExtension->MCR |= SR_MCR_DTR;
|
||||
WRITE_PORT_UCHAR(SER_MCR(ComPortBase), DeviceExtension->MCR);
|
||||
Status = IoAcquireRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
DeviceExtension->MCR |= SR_MCR_DTR;
|
||||
WRITE_PORT_UCHAR(SER_MCR(ComPortBase), DeviceExtension->MCR);
|
||||
IoReleaseRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
|
||||
}
|
||||
}
|
||||
Status = STATUS_SUCCESS;
|
||||
else
|
||||
Status = STATUS_SUCCESS;
|
||||
break;
|
||||
}
|
||||
case IOCTL_SERIAL_SET_FIFO_CONTROL:
|
||||
{
|
||||
DPRINT("Serial: IOCTL_SERIAL_SET_FIFO_CONTROL\n");
|
||||
if (LengthIn != sizeof(ULONG) || Buffer == NULL)
|
||||
if (LengthIn != sizeof(ULONG) || BufferIn == NULL)
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
else
|
||||
{
|
||||
WRITE_PORT_UCHAR(SER_FCR(ComPortBase), (UCHAR)((*(PULONG)Buffer) & 0xff));
|
||||
Status = STATUS_SUCCESS;
|
||||
Status = IoAcquireRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
WRITE_PORT_UCHAR(SER_FCR(ComPortBase), (UCHAR)((*(PULONG)BufferIn) & 0xff));
|
||||
IoReleaseRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -601,24 +709,28 @@ SerialDeviceControl(
|
||||
DPRINT("Serial: IOCTL_SERIAL_SET_LINE_CONTROL\n");
|
||||
if (LengthIn < sizeof(SERIAL_LINE_CONTROL))
|
||||
Status = STATUS_BUFFER_TOO_SMALL;
|
||||
else if (Buffer == NULL)
|
||||
else if (BufferIn == NULL)
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
else
|
||||
Status = SerialSetLineControl(DeviceExtension, (PSERIAL_LINE_CONTROL)Buffer);
|
||||
Status = SerialSetLineControl(DeviceExtension, (PSERIAL_LINE_CONTROL)BufferIn);
|
||||
break;
|
||||
}
|
||||
case IOCTL_SERIAL_SET_MODEM_CONTROL:
|
||||
{
|
||||
PULONG pMCR;
|
||||
DPRINT("Serial: IOCTL_SERIAL_SET_MODEM_CONTROL\n");
|
||||
if (LengthIn != sizeof(ULONG) || Buffer == NULL)
|
||||
if (LengthIn != sizeof(ULONG) || BufferIn == NULL)
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
else
|
||||
{
|
||||
pMCR = (PULONG)Buffer;
|
||||
DeviceExtension->MCR = (UCHAR)(*pMCR & 0xff);
|
||||
WRITE_PORT_UCHAR(SER_MCR(ComPortBase), DeviceExtension->MCR);
|
||||
Status = STATUS_SUCCESS;
|
||||
Status = IoAcquireRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
pMCR = (PULONG)BufferIn;
|
||||
DeviceExtension->MCR = (UCHAR)(*pMCR & 0xff);
|
||||
WRITE_PORT_UCHAR(SER_MCR(ComPortBase), DeviceExtension->MCR);
|
||||
IoReleaseRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -626,22 +738,23 @@ SerialDeviceControl(
|
||||
{
|
||||
if (LengthIn < sizeof(SERIAL_QUEUE_SIZE ))
|
||||
return STATUS_BUFFER_TOO_SMALL;
|
||||
else if (Buffer == NULL)
|
||||
else if (BufferIn == NULL)
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
else
|
||||
{
|
||||
KIRQL Irql;
|
||||
PSERIAL_QUEUE_SIZE NewQueueSize = (PSERIAL_QUEUE_SIZE)BufferIn;
|
||||
Status = STATUS_SUCCESS;
|
||||
if (((PSERIAL_QUEUE_SIZE)Buffer)->InSize > DeviceExtension->InputBuffer.Length)
|
||||
if (NewQueueSize->InSize > DeviceExtension->InputBuffer.Length)
|
||||
{
|
||||
KeAcquireSpinLock(&DeviceExtension->InputBufferLock, &Irql);
|
||||
Status = IncreaseCircularBufferSize(&DeviceExtension->InputBuffer, ((PSERIAL_QUEUE_SIZE)Buffer)->InSize);
|
||||
Status = IncreaseCircularBufferSize(&DeviceExtension->InputBuffer, NewQueueSize->InSize);
|
||||
KeReleaseSpinLock(&DeviceExtension->InputBufferLock, Irql);
|
||||
}
|
||||
if (NT_SUCCESS(Status) && ((PSERIAL_QUEUE_SIZE)Buffer)->OutSize > DeviceExtension->OutputBuffer.Length)
|
||||
if (NT_SUCCESS(Status) && NewQueueSize->OutSize > DeviceExtension->OutputBuffer.Length)
|
||||
{
|
||||
KeAcquireSpinLock(&DeviceExtension->OutputBufferLock, &Irql);
|
||||
Status = IncreaseCircularBufferSize(&DeviceExtension->OutputBuffer, ((PSERIAL_QUEUE_SIZE)Buffer)->OutSize);
|
||||
Status = IncreaseCircularBufferSize(&DeviceExtension->OutputBuffer, NewQueueSize->OutSize);
|
||||
KeReleaseSpinLock(&DeviceExtension->OutputBufferLock, Irql);
|
||||
}
|
||||
}
|
||||
@@ -654,20 +767,26 @@ SerialDeviceControl(
|
||||
DPRINT("Serial: IOCTL_SERIAL_SET_RTS\n");
|
||||
if (!(DeviceExtension->MCR & SR_MCR_RTS))
|
||||
{
|
||||
DeviceExtension->MCR |= SR_MCR_RTS;
|
||||
WRITE_PORT_UCHAR(SER_MCR(ComPortBase), DeviceExtension->MCR);
|
||||
Status = IoAcquireRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
DeviceExtension->MCR |= SR_MCR_RTS;
|
||||
WRITE_PORT_UCHAR(SER_MCR(ComPortBase), DeviceExtension->MCR);
|
||||
IoReleaseRemoveLock(&DeviceExtension->RemoveLock, (PVOID)DeviceExtension->ComPort);
|
||||
}
|
||||
}
|
||||
Status = STATUS_SUCCESS;
|
||||
else
|
||||
Status = STATUS_SUCCESS;
|
||||
break;
|
||||
}
|
||||
case IOCTL_SERIAL_SET_TIMEOUTS:
|
||||
{
|
||||
DPRINT("Serial: IOCTL_SERIAL_SET_TIMEOUTS\n");
|
||||
if (LengthIn != sizeof(SERIAL_TIMEOUTS) || Buffer == NULL)
|
||||
if (LengthIn != sizeof(SERIAL_TIMEOUTS) || BufferIn == NULL)
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
else
|
||||
{
|
||||
DeviceExtension->SerialTimeOuts = *(PSERIAL_TIMEOUTS)Buffer;
|
||||
DeviceExtension->SerialTimeOuts = *(PSERIAL_TIMEOUTS)BufferIn;
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
break;
|
||||
@@ -676,11 +795,11 @@ SerialDeviceControl(
|
||||
{
|
||||
PULONG pWaitMask;
|
||||
DPRINT("Serial: IOCTL_SERIAL_SET_WAIT_MASK\n");
|
||||
if (LengthIn != sizeof(ULONG) || Buffer == NULL)
|
||||
if (LengthIn != sizeof(ULONG) || BufferIn == NULL)
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
else
|
||||
{
|
||||
pWaitMask = (PULONG)Buffer;
|
||||
pWaitMask = (PULONG)BufferIn;
|
||||
DeviceExtension->WaitMask = *pWaitMask;
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
|
@@ -20,7 +20,7 @@ SerialQueryInformation(
|
||||
PIO_STACK_LOCATION Stack;
|
||||
PVOID SystemBuffer;
|
||||
ULONG BufferLength;
|
||||
ULONG Information = 0;
|
||||
ULONG_PTR Information = 0;
|
||||
NTSTATUS Status;
|
||||
|
||||
DeviceExtension = (PSERIAL_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
@@ -37,12 +37,13 @@ SerialQueryInformation(
|
||||
DPRINT("Serial: IRP_MJ_QUERY_INFORMATION / FileStandardInformation\n");
|
||||
if (BufferLength < sizeof(FILE_STANDARD_INFORMATION))
|
||||
Status = STATUS_BUFFER_OVERFLOW;
|
||||
else
|
||||
else if (!StandardInfo)
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
{
|
||||
StandardInfo->AllocationSize.QuadPart = 0;
|
||||
StandardInfo->EndOfFile.QuadPart = 0;
|
||||
StandardInfo->Directory = FALSE;
|
||||
StandardInfo->NumberOfLinks = 0;
|
||||
StandardInfo->Directory = FALSE;
|
||||
StandardInfo->NumberOfLinks = 0;
|
||||
StandardInfo->DeletePending = FALSE; /* FIXME: should be TRUE sometimes */
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
@@ -52,9 +53,13 @@ SerialQueryInformation(
|
||||
{
|
||||
PFILE_POSITION_INFORMATION PositionInfo = (PFILE_POSITION_INFORMATION)SystemBuffer;
|
||||
|
||||
ASSERT(PositionInfo);
|
||||
|
||||
DPRINT("Serial: IRP_MJ_QUERY_INFORMATION / FilePositionInformation\n");
|
||||
if (BufferLength < sizeof(PFILE_POSITION_INFORMATION))
|
||||
Status = STATUS_BUFFER_OVERFLOW;
|
||||
else if (!PositionInfo)
|
||||
Status = STATUS_INVALID_PARAMETER;
|
||||
else
|
||||
{
|
||||
PositionInfo->CurrentByteOffset.QuadPart = 0;
|
||||
|
@@ -1,180 +1,194 @@
|
||||
/* $Id:
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: drivers/bus/serial/legacy.c
|
||||
* PURPOSE: Legacy serial port enumeration
|
||||
*
|
||||
* PROGRAMMERS: Herv<72> Poussineau (poussine@freesurf.fr)
|
||||
* Mark Junker (mjscod@gmx.de)
|
||||
*/
|
||||
|
||||
#define NDEBUG
|
||||
#include "serial.h"
|
||||
|
||||
UART_TYPE
|
||||
SerialDetectUartType(
|
||||
IN PUCHAR BaseAddress)
|
||||
{
|
||||
UCHAR Lcr, TestLcr;
|
||||
UCHAR OldScr, Scr5A, ScrA5;
|
||||
BOOLEAN FifoEnabled;
|
||||
UCHAR NewFifoStatus;
|
||||
|
||||
Lcr = READ_PORT_UCHAR(SER_LCR(BaseAddress));
|
||||
WRITE_PORT_UCHAR(SER_LCR(BaseAddress), Lcr ^ 0xFF);
|
||||
TestLcr = READ_PORT_UCHAR(SER_LCR(BaseAddress)) ^ 0xFF;
|
||||
WRITE_PORT_UCHAR(SER_LCR(BaseAddress), Lcr);
|
||||
|
||||
/* Accessing the LCR must work for a usable serial port */
|
||||
if (TestLcr != Lcr)
|
||||
return UartUnknown;
|
||||
|
||||
/* Ensure that all following accesses are done as required */
|
||||
READ_PORT_UCHAR(SER_RBR(BaseAddress));
|
||||
READ_PORT_UCHAR(SER_IER(BaseAddress));
|
||||
READ_PORT_UCHAR(SER_IIR(BaseAddress));
|
||||
READ_PORT_UCHAR(SER_LCR(BaseAddress));
|
||||
READ_PORT_UCHAR(SER_MCR(BaseAddress));
|
||||
READ_PORT_UCHAR(SER_LSR(BaseAddress));
|
||||
READ_PORT_UCHAR(SER_MSR(BaseAddress));
|
||||
READ_PORT_UCHAR(SER_SCR(BaseAddress));
|
||||
|
||||
/* Test scratch pad */
|
||||
OldScr = READ_PORT_UCHAR(SER_SCR(BaseAddress));
|
||||
WRITE_PORT_UCHAR(SER_SCR(BaseAddress), 0x5A);
|
||||
Scr5A = READ_PORT_UCHAR(SER_SCR(BaseAddress));
|
||||
WRITE_PORT_UCHAR(SER_SCR(BaseAddress), 0xA5);
|
||||
ScrA5 = READ_PORT_UCHAR(SER_SCR(BaseAddress));
|
||||
WRITE_PORT_UCHAR(SER_SCR(BaseAddress), OldScr);
|
||||
|
||||
/* When non-functional, we have a 8250 */
|
||||
if (Scr5A != 0x5A || ScrA5 != 0xA5)
|
||||
return Uart8250;
|
||||
|
||||
/* Test FIFO type */
|
||||
FifoEnabled = (READ_PORT_UCHAR(SER_IIR(BaseAddress)) & 0x80) != 0;
|
||||
WRITE_PORT_UCHAR(SER_FCR(BaseAddress), SR_FCR_ENABLE_FIFO);
|
||||
NewFifoStatus = READ_PORT_UCHAR(SER_IIR(BaseAddress)) & 0xC0;
|
||||
if (!FifoEnabled)
|
||||
WRITE_PORT_UCHAR(SER_FCR(BaseAddress), 0);
|
||||
switch (NewFifoStatus)
|
||||
{
|
||||
case 0x00:
|
||||
return Uart16450;
|
||||
case 0x80:
|
||||
return Uart16550;
|
||||
}
|
||||
|
||||
/* FIFO is only functional for 16550A+ */
|
||||
return Uart16550A;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
DetectLegacyDevice(
|
||||
IN PDRIVER_OBJECT DriverObject,
|
||||
IN ULONG ComPortBase,
|
||||
IN ULONG Irq)
|
||||
{
|
||||
ULONG ResourceListSize;
|
||||
PCM_RESOURCE_LIST ResourceList;
|
||||
PCM_PARTIAL_RESOURCE_DESCRIPTOR ResourceDescriptor;
|
||||
BOOLEAN ConflictDetected;
|
||||
UART_TYPE UartType;
|
||||
PDEVICE_OBJECT Pdo = NULL;
|
||||
PDEVICE_OBJECT Fdo;
|
||||
KIRQL Dirql;
|
||||
NTSTATUS Status;
|
||||
|
||||
/* Create resource list */
|
||||
ResourceListSize = sizeof(CM_RESOURCE_LIST) + sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR);
|
||||
ResourceList = (PCM_RESOURCE_LIST)ExAllocatePoolWithTag(PagedPool, ResourceListSize, SERIAL_TAG);
|
||||
if (!ResourceList)
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
ResourceList->Count = 1;
|
||||
ResourceList->List[0].InterfaceType = Isa;
|
||||
ResourceList->List[0].BusNumber = -1; /* FIXME */
|
||||
ResourceList->List[0].PartialResourceList.Version = 1;
|
||||
ResourceList->List[0].PartialResourceList.Revision = 1;
|
||||
ResourceList->List[0].PartialResourceList.Count = 2;
|
||||
ResourceDescriptor = &ResourceList->List[0].PartialResourceList.PartialDescriptors[0];
|
||||
ResourceDescriptor->Type = CmResourceTypePort;
|
||||
ResourceDescriptor->ShareDisposition = CmResourceShareDriverExclusive;
|
||||
ResourceDescriptor->Flags = CM_RESOURCE_PORT_IO;
|
||||
ResourceDescriptor->u.Port.Start.u.HighPart = 0;
|
||||
ResourceDescriptor->u.Port.Start.u.LowPart = ComPortBase;
|
||||
ResourceDescriptor->u.Port.Length = 8;
|
||||
|
||||
ResourceDescriptor = &ResourceList->List[0].PartialResourceList.PartialDescriptors[1];
|
||||
ResourceDescriptor->Type = CmResourceTypeInterrupt;
|
||||
ResourceDescriptor->ShareDisposition = CmResourceShareShared;
|
||||
ResourceDescriptor->Flags = CM_RESOURCE_INTERRUPT_LATCHED;
|
||||
ResourceDescriptor->u.Interrupt.Vector = HalGetInterruptVector(
|
||||
Internal, 0, 0, Irq,
|
||||
&Dirql,
|
||||
&ResourceDescriptor->u.Interrupt.Affinity);
|
||||
ResourceDescriptor->u.Interrupt.Level = (ULONG)Dirql;
|
||||
|
||||
/* Report resource list */
|
||||
Status = IoReportResourceForDetection(
|
||||
DriverObject, ResourceList, ResourceListSize,
|
||||
NULL, NULL, 0,
|
||||
&ConflictDetected);
|
||||
if (Status == STATUS_CONFLICTING_ADDRESSES)
|
||||
return STATUS_DEVICE_NOT_CONNECTED;
|
||||
if (!NT_SUCCESS(Status))
|
||||
return Status;
|
||||
|
||||
/* Test if port exists */
|
||||
UartType = SerialDetectUartType((PUCHAR)ComPortBase);
|
||||
|
||||
/* Report device if detected... */
|
||||
if (UartType != UartUnknown)
|
||||
{
|
||||
Status = IoReportDetectedDevice(
|
||||
DriverObject,
|
||||
ResourceList->List[0].InterfaceType, ResourceList->List[0].BusNumber, -1/*FIXME*/,
|
||||
ResourceList, NULL,
|
||||
TRUE,
|
||||
&Pdo);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
Status = SerialAddDeviceInternal(DriverObject, Pdo, UartType, &Fdo);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
Status = SerialPnpStartDevice(Fdo, ResourceList);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Release resources */
|
||||
Status = IoReportResourceForDetection(
|
||||
DriverObject, NULL, 0,
|
||||
NULL, NULL, 0,
|
||||
&ConflictDetected);
|
||||
Status = STATUS_DEVICE_NOT_CONNECTED;
|
||||
}
|
||||
return Status;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
DetectLegacyDevices(
|
||||
IN PDRIVER_OBJECT DriverObject)
|
||||
{
|
||||
ULONG ComPortBase[] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8 };
|
||||
ULONG Irq[] = { 4, 3, 4, 3 };
|
||||
ULONG i;
|
||||
NTSTATUS Status;
|
||||
NTSTATUS ReturnedStatus = STATUS_SUCCESS;
|
||||
|
||||
for (i = 0; i < sizeof(ComPortBase)/sizeof(ComPortBase[0]); i++)
|
||||
{
|
||||
Status = DetectLegacyDevice(DriverObject, ComPortBase[i], Irq[i]);
|
||||
if (!NT_SUCCESS(Status) && Status != STATUS_DEVICE_NOT_CONNECTED)
|
||||
ReturnedStatus = Status;
|
||||
DPRINT("Serial: Legacy device at 0x%x (IRQ %lu): status = 0x%08lx\n", ComPortBase[i], Irq[i], Status);
|
||||
}
|
||||
|
||||
return ReturnedStatus;
|
||||
}
|
||||
/* $Id:
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: drivers/bus/serial/legacy.c
|
||||
* PURPOSE: Legacy serial port enumeration
|
||||
*
|
||||
* PROGRAMMERS: Herv<72> Poussineau (poussine@freesurf.fr)
|
||||
* Mark Junker (mjscod@gmx.de)
|
||||
*/
|
||||
|
||||
#define NDEBUG
|
||||
#include "serial.h"
|
||||
|
||||
UART_TYPE
|
||||
SerialDetectUartType(
|
||||
IN PUCHAR BaseAddress)
|
||||
{
|
||||
UCHAR Lcr, TestLcr;
|
||||
UCHAR OldScr, Scr5A, ScrA5;
|
||||
BOOLEAN FifoEnabled;
|
||||
UCHAR NewFifoStatus;
|
||||
|
||||
Lcr = READ_PORT_UCHAR(SER_LCR(BaseAddress));
|
||||
WRITE_PORT_UCHAR(SER_LCR(BaseAddress), Lcr ^ 0xFF);
|
||||
TestLcr = READ_PORT_UCHAR(SER_LCR(BaseAddress)) ^ 0xFF;
|
||||
WRITE_PORT_UCHAR(SER_LCR(BaseAddress), Lcr);
|
||||
|
||||
/* Accessing the LCR must work for a usable serial port */
|
||||
if (TestLcr != Lcr)
|
||||
return UartUnknown;
|
||||
|
||||
/* Ensure that all following accesses are done as required */
|
||||
READ_PORT_UCHAR(SER_RBR(BaseAddress));
|
||||
READ_PORT_UCHAR(SER_IER(BaseAddress));
|
||||
READ_PORT_UCHAR(SER_IIR(BaseAddress));
|
||||
READ_PORT_UCHAR(SER_LCR(BaseAddress));
|
||||
READ_PORT_UCHAR(SER_MCR(BaseAddress));
|
||||
READ_PORT_UCHAR(SER_LSR(BaseAddress));
|
||||
READ_PORT_UCHAR(SER_MSR(BaseAddress));
|
||||
READ_PORT_UCHAR(SER_SCR(BaseAddress));
|
||||
|
||||
/* Test scratch pad */
|
||||
OldScr = READ_PORT_UCHAR(SER_SCR(BaseAddress));
|
||||
WRITE_PORT_UCHAR(SER_SCR(BaseAddress), 0x5A);
|
||||
Scr5A = READ_PORT_UCHAR(SER_SCR(BaseAddress));
|
||||
WRITE_PORT_UCHAR(SER_SCR(BaseAddress), 0xA5);
|
||||
ScrA5 = READ_PORT_UCHAR(SER_SCR(BaseAddress));
|
||||
WRITE_PORT_UCHAR(SER_SCR(BaseAddress), OldScr);
|
||||
|
||||
/* When non-functional, we have a 8250 */
|
||||
if (Scr5A != 0x5A || ScrA5 != 0xA5)
|
||||
return Uart8250;
|
||||
|
||||
/* Test FIFO type */
|
||||
FifoEnabled = (READ_PORT_UCHAR(SER_IIR(BaseAddress)) & 0x80) != 0;
|
||||
WRITE_PORT_UCHAR(SER_FCR(BaseAddress), SR_FCR_ENABLE_FIFO);
|
||||
NewFifoStatus = READ_PORT_UCHAR(SER_IIR(BaseAddress)) & 0xC0;
|
||||
if (!FifoEnabled)
|
||||
WRITE_PORT_UCHAR(SER_FCR(BaseAddress), 0);
|
||||
switch (NewFifoStatus)
|
||||
{
|
||||
case 0x00:
|
||||
return Uart16450;
|
||||
case 0x40:
|
||||
case 0x80:
|
||||
/* Not sure about this but the documentation says that 0x40
|
||||
* indicates an unusable FIFO but my tests only worked
|
||||
* with 0x80 */
|
||||
return Uart16550;
|
||||
}
|
||||
|
||||
/* FIFO is only functional for 16550A+ */
|
||||
return Uart16550A;
|
||||
}
|
||||
|
||||
static NTSTATUS
|
||||
DetectLegacyDevice(
|
||||
IN PDRIVER_OBJECT DriverObject,
|
||||
IN ULONG ComPortBase,
|
||||
IN ULONG Irq,
|
||||
IN PULONG pComPortNumber OPTIONAL)
|
||||
{
|
||||
ULONG ResourceListSize;
|
||||
PCM_RESOURCE_LIST ResourceList;
|
||||
PCM_PARTIAL_RESOURCE_DESCRIPTOR ResourceDescriptor;
|
||||
BOOLEAN ConflictDetected;
|
||||
UART_TYPE UartType;
|
||||
PDEVICE_OBJECT Pdo = NULL;
|
||||
PDEVICE_OBJECT Fdo;
|
||||
KIRQL Dirql;
|
||||
NTSTATUS Status;
|
||||
|
||||
/* Create resource list */
|
||||
ResourceListSize = sizeof(CM_RESOURCE_LIST) + sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR);
|
||||
ResourceList = (PCM_RESOURCE_LIST)ExAllocatePoolWithTag(PagedPool, ResourceListSize, SERIAL_TAG);
|
||||
if (!ResourceList)
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
ResourceList->Count = 1;
|
||||
ResourceList->List[0].InterfaceType = InterfaceTypeUndefined;
|
||||
ResourceList->List[0].BusNumber = -1; /* unknown */
|
||||
ResourceList->List[0].PartialResourceList.Version = 1;
|
||||
ResourceList->List[0].PartialResourceList.Revision = 1;
|
||||
ResourceList->List[0].PartialResourceList.Count = 2;
|
||||
ResourceDescriptor = &ResourceList->List[0].PartialResourceList.PartialDescriptors[0];
|
||||
ResourceDescriptor->Type = CmResourceTypePort;
|
||||
ResourceDescriptor->ShareDisposition = CmResourceShareDriverExclusive;
|
||||
ResourceDescriptor->Flags = CM_RESOURCE_PORT_IO;
|
||||
ResourceDescriptor->u.Port.Start.u.HighPart = 0;
|
||||
ResourceDescriptor->u.Port.Start.u.LowPart = ComPortBase;
|
||||
ResourceDescriptor->u.Port.Length = 8;
|
||||
|
||||
ResourceDescriptor = &ResourceList->List[0].PartialResourceList.PartialDescriptors[1];
|
||||
ResourceDescriptor->Type = CmResourceTypeInterrupt;
|
||||
ResourceDescriptor->ShareDisposition = CmResourceShareShared;
|
||||
ResourceDescriptor->Flags = CM_RESOURCE_INTERRUPT_LATCHED;
|
||||
ResourceDescriptor->u.Interrupt.Vector = HalGetInterruptVector(
|
||||
Internal, 0, 0, Irq,
|
||||
&Dirql,
|
||||
&ResourceDescriptor->u.Interrupt.Affinity);
|
||||
ResourceDescriptor->u.Interrupt.Level = (ULONG)Dirql;
|
||||
|
||||
/* Report resource list */
|
||||
Status = IoReportResourceForDetection(
|
||||
DriverObject, ResourceList, ResourceListSize,
|
||||
NULL, NULL, 0,
|
||||
&ConflictDetected);
|
||||
if (Status == STATUS_CONFLICTING_ADDRESSES)
|
||||
{
|
||||
DPRINT("Serial: conflict detected for serial port at 0x%lx (Irq %lu)\n", ComPortBase, Irq);
|
||||
ExFreePoolWithTag(ResourceList, SERIAL_TAG);
|
||||
return STATUS_DEVICE_NOT_CONNECTED;
|
||||
}
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ExFreePoolWithTag(ResourceList, SERIAL_TAG);
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* Test if port exists */
|
||||
UartType = SerialDetectUartType((PUCHAR)ComPortBase);
|
||||
|
||||
/* Report device if detected... */
|
||||
if (UartType != UartUnknown)
|
||||
{
|
||||
Status = IoReportDetectedDevice(
|
||||
DriverObject,
|
||||
ResourceList->List[0].InterfaceType, ResourceList->List[0].BusNumber, -1 /* unknown */,
|
||||
ResourceList, NULL,
|
||||
TRUE,
|
||||
&Pdo);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
Status = SerialAddDeviceInternal(DriverObject, Pdo, UartType, pComPortNumber, &Fdo);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
Status = SerialPnpStartDevice(Fdo, ResourceList);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Release resources */
|
||||
Status = IoReportResourceForDetection(
|
||||
DriverObject, NULL, 0,
|
||||
NULL, NULL, 0,
|
||||
&ConflictDetected);
|
||||
Status = STATUS_DEVICE_NOT_CONNECTED;
|
||||
}
|
||||
ExFreePoolWithTag(ResourceList, SERIAL_TAG);
|
||||
return Status;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
DetectLegacyDevices(
|
||||
IN PDRIVER_OBJECT DriverObject)
|
||||
{
|
||||
ULONG ComPortBase[] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8 };
|
||||
ULONG Irq[] = { 4, 3, 4, 3 };
|
||||
ULONG ComPortNumber[] = { 1, 2, 3, 4 };
|
||||
ULONG i;
|
||||
NTSTATUS Status;
|
||||
NTSTATUS ReturnedStatus = STATUS_SUCCESS;
|
||||
|
||||
for (i = 0; i < sizeof(ComPortBase)/sizeof(ComPortBase[0]); i++)
|
||||
{
|
||||
Status = DetectLegacyDevice(DriverObject, ComPortBase[i], Irq[i], &ComPortNumber[i]);
|
||||
if (!NT_SUCCESS(Status) && Status != STATUS_DEVICE_NOT_CONNECTED)
|
||||
ReturnedStatus = Status;
|
||||
DPRINT("Serial: Legacy device at 0x%x (IRQ %lu): status = 0x%08lx\n", ComPortBase[i], Irq[i], Status);
|
||||
}
|
||||
|
||||
return ReturnedStatus;
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user