mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-03 12:23:25 +00:00
Merge 14981:15268 from trunk
svn path=/branches/xmlbuildsystem/; revision=15273
This commit is contained in:
@@ -6,7 +6,7 @@ int main(int argc, char* argv[])
|
||||
int i;
|
||||
FILE* in;
|
||||
char ch;
|
||||
|
||||
|
||||
for (i=1; i<argc; i++)
|
||||
{
|
||||
in = fopen(argv[i],"r");
|
||||
@@ -15,7 +15,7 @@ int main(int argc, char* argv[])
|
||||
printf("Failed to open file %s\n", argv[i]);
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
while ((ch = fgetc(in)) != EOF)
|
||||
{
|
||||
putchar(ch);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Load a device driver
|
||||
*/
|
||||
*/
|
||||
#include <windows.h>
|
||||
#include <ntos/zw.h>
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Unload a device driver
|
||||
*/
|
||||
*/
|
||||
#include <windows.h>
|
||||
#include <ntos/zw.h>
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Diagnostic Trace
|
||||
//
|
||||
#include <stdio.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
||||
@@ -151,10 +151,10 @@ userlist(int argc, char **argv)
|
||||
fprintf(stderr, "Warning: Can't do local finger\n");
|
||||
}
|
||||
|
||||
/* Start winsock */
|
||||
/* Start winsock */
|
||||
wVersionRequested = MAKEWORD( 1, 1 );
|
||||
iErr = WSAStartup( wVersionRequested, &wsaData );
|
||||
if ( iErr != 0 )
|
||||
if ( iErr != 0 )
|
||||
{
|
||||
/* Tell the user that we couldn't find a usable */
|
||||
/* WinSock DLL. */
|
||||
|
||||
@@ -110,7 +110,7 @@ netfinger(char *name)
|
||||
* Otherwise, all high bits are stripped; if it isn't printable and
|
||||
* it isn't a space, we can simply set the 7th bit. Every ASCII
|
||||
* character with bit 7 set is printable.
|
||||
*/
|
||||
*/
|
||||
lastc = 0;
|
||||
while (recv(s, &c, 1, 0) == 1) {
|
||||
c &= 0x7f;
|
||||
|
||||
@@ -92,7 +92,7 @@ int fgetcSocket(int s)
|
||||
{
|
||||
static int index = 0;
|
||||
static int total = 0;
|
||||
static unsigned char buffer[4096];
|
||||
static char buffer[4096];
|
||||
|
||||
if (index == total)
|
||||
{
|
||||
@@ -142,7 +142,7 @@ int fputcSocket(int s, char putChar)
|
||||
buffer[1] = '\0';
|
||||
|
||||
if(SOCKET_ERROR==send(s, buffer, 1, 0)) {
|
||||
int iret=WSAGetLastError ();
|
||||
int iret=WSAGetLastError ();
|
||||
fprintf(stdout,"fputcSocket: %d\n",iret);
|
||||
return 0;
|
||||
}
|
||||
@@ -154,9 +154,9 @@ int fputSocket(int s, char *buffer, int len)
|
||||
{
|
||||
int iret;
|
||||
while(len) {
|
||||
if(SOCKET_ERROR==(iret=send(s, buffer, len, 0)))
|
||||
if(SOCKET_ERROR==(iret=send(s, buffer, len, 0)))
|
||||
{
|
||||
iret=WSAGetLastError ();
|
||||
iret=WSAGetLastError ();
|
||||
fprintf(stdout,"fputcSocket: %d\n",iret);
|
||||
return 0;
|
||||
}
|
||||
@@ -187,7 +187,7 @@ char *fgetsSocket(int s, char *string)
|
||||
if (count == 1)
|
||||
{
|
||||
string[i] = buffer[0];
|
||||
|
||||
|
||||
if (i == MAX_ASCII - 3)
|
||||
{
|
||||
count = 0;
|
||||
|
||||
@@ -126,7 +126,7 @@ next:
|
||||
|
||||
case LOGIN:
|
||||
if (token())
|
||||
if (*aname == 0) {
|
||||
if (*aname == 0) {
|
||||
*aname = malloc((unsigned) strlen(tokval) + 1);
|
||||
(void) strcpy(*aname, tokval);
|
||||
} else {
|
||||
@@ -237,7 +237,7 @@ static int token(void)
|
||||
char *cp;
|
||||
int c;
|
||||
struct toktab *t;
|
||||
|
||||
|
||||
if (feof(cfile))
|
||||
return (0);
|
||||
while ((c = getc(cfile)) != EOF &&
|
||||
|
||||
@@ -132,13 +132,13 @@ static void ShowNetworkInterfaces()
|
||||
}
|
||||
/*
|
||||
typedef struct _IP_ADAPTER_INDEX_MAP {
|
||||
ULONG Index; // adapter index
|
||||
WCHAR Name[MAX_ADAPTER_NAME]; // name of the adapter
|
||||
ULONG Index; // adapter index
|
||||
WCHAR Name[MAX_ADAPTER_NAME]; // name of the adapter
|
||||
} IP_ADAPTER_INDEX_MAP, * PIP_ADAPTER_INDEX_MAP;
|
||||
|
||||
typedef struct _IP_INTERFACE_INFO {
|
||||
LONG NumAdapters; // number of adapters in array
|
||||
IP_ADAPTER_INDEX_MAP Adapter[1]; // adapter indices and names
|
||||
LONG NumAdapters; // number of adapters in array
|
||||
IP_ADAPTER_INDEX_MAP Adapter[1]; // adapter indices and names
|
||||
} IP_INTERFACE_INFO,*PIP_INTERFACE_INFO;
|
||||
*/
|
||||
result = GetInterfaceInfo(pIfTable, &dwOutBufLen);
|
||||
@@ -194,7 +194,7 @@ typedef struct _IP_ADAPTER_INFO {
|
||||
IP_ADDR_STRING PrimaryWinsServer;
|
||||
IP_ADDR_STRING SecondaryWinsServer;
|
||||
a time_t LeaseObtained;
|
||||
b time_t LeaseExpires;
|
||||
b time_t LeaseExpires;
|
||||
} IP_ADAPTER_INFO, *PIP_ADAPTER_INFO;
|
||||
*/
|
||||
/*
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Diagnostic Trace
|
||||
//
|
||||
#include <stdio.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
||||
@@ -52,7 +52,7 @@ static char TcpState[][32] = {
|
||||
VOID PrintError(DWORD ErrorCode)
|
||||
{
|
||||
LPVOID lpMsgBuf;
|
||||
|
||||
|
||||
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
|
||||
NULL, ErrorCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||
(LPTSTR)&lpMsgBuf, 0, NULL);
|
||||
@@ -66,21 +66,21 @@ static void ShowTcpStatistics()
|
||||
GetTcpStatistics(&TcpStatsMIB);
|
||||
|
||||
_tprintf(_T("TCP/IP Statistics\t\n"));
|
||||
_tprintf(_T(" time-out algorithm:\t\t%d\n"), TcpStatsMIB.dwRtoAlgorithm);
|
||||
_tprintf(_T(" minimum time-out:\t\t%d\n"), TcpStatsMIB.dwRtoMin);
|
||||
_tprintf(_T(" maximum time-out:\t\t%d\n"), TcpStatsMIB.dwRtoMax);
|
||||
_tprintf(_T(" maximum connections:\t\t%d\n"), TcpStatsMIB.dwMaxConn);
|
||||
_tprintf(_T(" active opens:\t\t\t%d\n"), TcpStatsMIB.dwActiveOpens);
|
||||
_tprintf(_T(" passive opens:\t\t\t%d\n"), TcpStatsMIB.dwPassiveOpens);
|
||||
_tprintf(_T(" failed attempts:\t\t%d\n"), TcpStatsMIB.dwAttemptFails);
|
||||
_tprintf(_T(" established connections reset:\t%d\n"), TcpStatsMIB.dwEstabResets);
|
||||
_tprintf(_T(" established connections:\t%d\n"), TcpStatsMIB.dwCurrEstab);
|
||||
_tprintf(_T(" segments received:\t\t%d\n"), TcpStatsMIB.dwInSegs);
|
||||
_tprintf(_T(" segment sent:\t\t\t%d\n"), TcpStatsMIB.dwOutSegs);
|
||||
_tprintf(_T(" segments retransmitted:\t\t%d\n"), TcpStatsMIB.dwRetransSegs);
|
||||
_tprintf(_T(" incoming errors:\t\t%d\n"), TcpStatsMIB.dwInErrs);
|
||||
_tprintf(_T(" outgoing resets:\t\t%d\n"), TcpStatsMIB.dwOutRsts);
|
||||
_tprintf(_T(" cumulative connections:\t\t%d\n"), TcpStatsMIB.dwNumConns);
|
||||
_tprintf(_T(" time-out algorithm:\t\t%d\n"), TcpStatsMIB.dwRtoAlgorithm);
|
||||
_tprintf(_T(" minimum time-out:\t\t%d\n"), TcpStatsMIB.dwRtoMin);
|
||||
_tprintf(_T(" maximum time-out:\t\t%d\n"), TcpStatsMIB.dwRtoMax);
|
||||
_tprintf(_T(" maximum connections:\t\t%d\n"), TcpStatsMIB.dwMaxConn);
|
||||
_tprintf(_T(" active opens:\t\t\t%d\n"), TcpStatsMIB.dwActiveOpens);
|
||||
_tprintf(_T(" passive opens:\t\t\t%d\n"), TcpStatsMIB.dwPassiveOpens);
|
||||
_tprintf(_T(" failed attempts:\t\t%d\n"), TcpStatsMIB.dwAttemptFails);
|
||||
_tprintf(_T(" established connections reset:\t%d\n"), TcpStatsMIB.dwEstabResets);
|
||||
_tprintf(_T(" established connections:\t%d\n"), TcpStatsMIB.dwCurrEstab);
|
||||
_tprintf(_T(" segments received:\t\t%d\n"), TcpStatsMIB.dwInSegs);
|
||||
_tprintf(_T(" segment sent:\t\t\t%d\n"), TcpStatsMIB.dwOutSegs);
|
||||
_tprintf(_T(" segments retransmitted:\t\t%d\n"), TcpStatsMIB.dwRetransSegs);
|
||||
_tprintf(_T(" incoming errors:\t\t%d\n"), TcpStatsMIB.dwInErrs);
|
||||
_tprintf(_T(" outgoing resets:\t\t%d\n"), TcpStatsMIB.dwOutRsts);
|
||||
_tprintf(_T(" cumulative connections:\t\t%d\n"), TcpStatsMIB.dwNumConns);
|
||||
}
|
||||
|
||||
static void ShowUdpStatistics()
|
||||
@@ -90,7 +90,7 @@ static void ShowUdpStatistics()
|
||||
|
||||
_tprintf(_T("UDP Statistics\t\n"));
|
||||
_tprintf(_T(" received datagrams:\t\t\t%d\n"), UDPStatsMIB.dwInDatagrams);
|
||||
_tprintf(_T(" datagrams for which no port exists:\t%d\n"), UDPStatsMIB.dwNoPorts);
|
||||
_tprintf(_T(" datagrams for which no port exists:\t%d\n"), UDPStatsMIB.dwNoPorts);
|
||||
_tprintf(_T(" errors on received datagrams:\t\t%d\n"), UDPStatsMIB.dwInErrors);
|
||||
_tprintf(_T(" sent datagrams:\t\t\t\t%d\n"), UDPStatsMIB.dwOutDatagrams);
|
||||
_tprintf(_T(" number of entries in listener table:\t%d\n"), UDPStatsMIB.dwNumAddrs);
|
||||
@@ -102,27 +102,27 @@ static void ShowIpStatistics()
|
||||
GetIpStatistics(&IPStatsMIB);
|
||||
|
||||
_tprintf(_T("IP Statistics\t\n"));
|
||||
_tprintf(_T(" IP forwarding enabled or disabled:\t%d\n"), IPStatsMIB.dwForwarding);
|
||||
_tprintf(_T(" default time-to-live:\t\t\t%d\n"), IPStatsMIB.dwDefaultTTL);
|
||||
_tprintf(_T(" datagrams received:\t\t\t%d\n"), IPStatsMIB.dwInReceives);
|
||||
_tprintf(_T(" received header errors:\t\t\t%d\n"), IPStatsMIB.dwInHdrErrors);
|
||||
_tprintf(_T(" received address errors:\t\t%d\n"), IPStatsMIB.dwInAddrErrors);
|
||||
_tprintf(_T(" datagrams forwarded:\t\t\t%d\n"), IPStatsMIB.dwForwDatagrams);
|
||||
_tprintf(_T(" datagrams with unknown protocol:\t%d\n"), IPStatsMIB.dwInUnknownProtos);
|
||||
_tprintf(_T(" received datagrams discarded:\t\t%d\n"), IPStatsMIB.dwInDiscards);
|
||||
_tprintf(_T(" received datagrams delivered:\t\t%d\n"), IPStatsMIB.dwInDelivers);
|
||||
_tprintf(_T(" sent datagrams discarded:\t\t%d\n"), IPStatsMIB.dwOutDiscards);
|
||||
_tprintf(_T(" datagrams for which no route exists:\t%d\n"), IPStatsMIB.dwOutNoRoutes);
|
||||
_tprintf(_T(" datagrams for which frags didn't arrive:%d\n"), IPStatsMIB.dwReasmTimeout);
|
||||
_tprintf(_T(" datagrams requiring reassembly:\t\t%d\n"), IPStatsMIB.dwReasmReqds);
|
||||
_tprintf(_T(" successful reassemblies:\t\t%d\n"), IPStatsMIB.dwReasmOks);
|
||||
_tprintf(_T(" failed reassemblies:\t\t\t%d\n"), IPStatsMIB.dwReasmFails);
|
||||
_tprintf(_T(" successful fragmentations:\t\t%d\n"), IPStatsMIB.dwFragOks);
|
||||
_tprintf(_T(" failed fragmentations:\t\t\t%d\n"), IPStatsMIB.dwFragFails);
|
||||
_tprintf(_T(" datagrams fragmented:\t\t\t%d\n"), IPStatsMIB.dwFragCreates);
|
||||
_tprintf(_T(" number of interfaces on computer:\t%d\n"), IPStatsMIB.dwNumIf);
|
||||
_tprintf(_T(" number of IP address on computer:\t%d\n"), IPStatsMIB.dwNumAddr);
|
||||
_tprintf(_T(" number of routes in routing table:\t%d\n"), IPStatsMIB.dwNumRoutes);
|
||||
_tprintf(_T(" IP forwarding enabled or disabled:\t%d\n"), IPStatsMIB.dwForwarding);
|
||||
_tprintf(_T(" default time-to-live:\t\t\t%d\n"), IPStatsMIB.dwDefaultTTL);
|
||||
_tprintf(_T(" datagrams received:\t\t\t%d\n"), IPStatsMIB.dwInReceives);
|
||||
_tprintf(_T(" received header errors:\t\t\t%d\n"), IPStatsMIB.dwInHdrErrors);
|
||||
_tprintf(_T(" received address errors:\t\t%d\n"), IPStatsMIB.dwInAddrErrors);
|
||||
_tprintf(_T(" datagrams forwarded:\t\t\t%d\n"), IPStatsMIB.dwForwDatagrams);
|
||||
_tprintf(_T(" datagrams with unknown protocol:\t%d\n"), IPStatsMIB.dwInUnknownProtos);
|
||||
_tprintf(_T(" received datagrams discarded:\t\t%d\n"), IPStatsMIB.dwInDiscards);
|
||||
_tprintf(_T(" received datagrams delivered:\t\t%d\n"), IPStatsMIB.dwInDelivers);
|
||||
_tprintf(_T(" sent datagrams discarded:\t\t%d\n"), IPStatsMIB.dwOutDiscards);
|
||||
_tprintf(_T(" datagrams for which no route exists:\t%d\n"), IPStatsMIB.dwOutNoRoutes);
|
||||
_tprintf(_T(" datagrams for which frags didn't arrive:%d\n"), IPStatsMIB.dwReasmTimeout);
|
||||
_tprintf(_T(" datagrams requiring reassembly:\t\t%d\n"), IPStatsMIB.dwReasmReqds);
|
||||
_tprintf(_T(" successful reassemblies:\t\t%d\n"), IPStatsMIB.dwReasmOks);
|
||||
_tprintf(_T(" failed reassemblies:\t\t\t%d\n"), IPStatsMIB.dwReasmFails);
|
||||
_tprintf(_T(" successful fragmentations:\t\t%d\n"), IPStatsMIB.dwFragOks);
|
||||
_tprintf(_T(" failed fragmentations:\t\t\t%d\n"), IPStatsMIB.dwFragFails);
|
||||
_tprintf(_T(" datagrams fragmented:\t\t\t%d\n"), IPStatsMIB.dwFragCreates);
|
||||
_tprintf(_T(" number of interfaces on computer:\t%d\n"), IPStatsMIB.dwNumIf);
|
||||
_tprintf(_T(" number of IP address on computer:\t%d\n"), IPStatsMIB.dwNumAddr);
|
||||
_tprintf(_T(" number of routes in routing table:\t%d\n"), IPStatsMIB.dwNumRoutes);
|
||||
}
|
||||
|
||||
static void ShowNetworkParams()
|
||||
@@ -262,20 +262,20 @@ typedef struct {
|
||||
// Translate port numbers into their text equivalent if there is one
|
||||
//
|
||||
PCHAR
|
||||
GetPortName(DWORD Flags, UINT port, PCHAR proto, PCHAR name, int namelen)
|
||||
GetPortName(DWORD Flags, UINT port, PCHAR proto, PCHAR name, int namelen)
|
||||
{
|
||||
struct servent *psrvent;
|
||||
|
||||
if (Flags & FLAG_SHOW_NUMBERS) {
|
||||
sprintf(name, "%d", htons((WORD)port));
|
||||
return name;
|
||||
}
|
||||
}
|
||||
// Try to translate to a name
|
||||
if (psrvent = getservbyport(port, proto)) {
|
||||
strcpy(name, psrvent->s_name );
|
||||
} else {
|
||||
sprintf(name, "%d", htons((WORD)port));
|
||||
}
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
@@ -286,7 +286,7 @@ GetPortName(DWORD Flags, UINT port, PCHAR proto, PCHAR name, int namelen)
|
||||
// Translate IP addresses into their name-resolved form if possible.
|
||||
//
|
||||
PCHAR
|
||||
GetIpHostName(DWORD Flags, BOOL local, UINT ipaddr, PCHAR name, int namelen)
|
||||
GetIpHostName(DWORD Flags, BOOL local, UINT ipaddr, PCHAR name, int namelen)
|
||||
{
|
||||
// struct hostent *phostent;
|
||||
UINT nipaddr;
|
||||
@@ -294,7 +294,7 @@ GetIpHostName(DWORD Flags, BOOL local, UINT ipaddr, PCHAR name, int namelen)
|
||||
// Does the user want raw numbers?
|
||||
nipaddr = htonl(ipaddr);
|
||||
if (Flags & FLAG_SHOW_NUMBERS ) {
|
||||
sprintf(name, "%d.%d.%d.%d",
|
||||
sprintf(name, "%d.%d.%d.%d",
|
||||
(nipaddr >> 24) & 0xFF,
|
||||
(nipaddr >> 16) & 0xFF,
|
||||
(nipaddr >> 8) & 0xFF,
|
||||
@@ -307,7 +307,7 @@ GetIpHostName(DWORD Flags, BOOL local, UINT ipaddr, PCHAR name, int namelen)
|
||||
// Try to translate to a name
|
||||
if (!ipaddr) {
|
||||
if (!local) {
|
||||
sprintf(name, "%d.%d.%d.%d",
|
||||
sprintf(name, "%d.%d.%d.%d",
|
||||
(nipaddr >> 24) & 0xFF,
|
||||
(nipaddr >> 16) & 0xFF,
|
||||
(nipaddr >> 8) & 0xFF,
|
||||
@@ -339,7 +339,7 @@ GetIpHostName(DWORD Flags, BOOL local, UINT ipaddr, PCHAR name, int namelen)
|
||||
|
||||
sprintf(name, "%d.%d.%d.%d", i1,i2,i3,i4);
|
||||
#else
|
||||
sprintf(name, "%d.%d.%d.%d",
|
||||
sprintf(name, "%d.%d.%d.%d",
|
||||
((nipaddr >> 24) & 0x000000FF),
|
||||
((nipaddr >> 16) & 0x000000FF),
|
||||
((nipaddr >> 8) & 0x000000FF),
|
||||
@@ -360,10 +360,10 @@ BOOLEAN usage(void)
|
||||
|
||||
//
|
||||
// GetOptions
|
||||
//
|
||||
//
|
||||
// Parses the command line arguments.
|
||||
//
|
||||
BOOLEAN
|
||||
BOOLEAN
|
||||
GetOptions(int argc, char *argv[], PDWORD pFlags)
|
||||
{
|
||||
int i, j;
|
||||
@@ -466,12 +466,12 @@ int main(int argc, char *argv[])
|
||||
for (i = 0; i < tcpTable->dwNumEntries; i++) {
|
||||
if (flags & FLAG_SHOW_ALL_ENDPOINTS ||
|
||||
tcpTable->table[i].dwState == MIB_TCP_STATE_ESTAB) {
|
||||
sprintf(localaddr, "%s:%s",
|
||||
GetIpHostName(flags, TRUE, tcpTable->table[i].dwLocalAddr, localname, HOSTNAMELEN),
|
||||
sprintf(localaddr, "%s:%s",
|
||||
GetIpHostName(flags, TRUE, tcpTable->table[i].dwLocalAddr, localname, HOSTNAMELEN),
|
||||
GetPortName(flags, tcpTable->table[i].dwLocalPort, "tcp", localport, PORTNAMELEN));
|
||||
sprintf(remoteaddr, "%s:%s",
|
||||
GetIpHostName(flags, FALSE, tcpTable->table[i].dwRemoteAddr, remotename, HOSTNAMELEN),
|
||||
tcpTable->table[i].dwRemoteAddr ?
|
||||
GetIpHostName(flags, FALSE, tcpTable->table[i].dwRemoteAddr, remotename, HOSTNAMELEN),
|
||||
tcpTable->table[i].dwRemoteAddr ?
|
||||
GetPortName(flags, tcpTable->table[i].dwRemotePort, "tcp", remoteport, PORTNAMELEN):
|
||||
"0");
|
||||
printf("%4s\tState: %s\n", "[TCP]", TcpState[tcpTable->table[i].dwState]);
|
||||
@@ -481,14 +481,14 @@ int main(int argc, char *argv[])
|
||||
// Dump the UDP table
|
||||
if (flags & FLAG_SHOW_ALL_ENDPOINTS) {
|
||||
for (i = 0; i < udpTable->dwNumEntries; i++) {
|
||||
sprintf(localaddr, "%s:%s",
|
||||
GetIpHostName(flags, TRUE, udpTable->table[i].dwLocalAddr, localname, HOSTNAMELEN),
|
||||
sprintf(localaddr, "%s:%s",
|
||||
GetIpHostName(flags, TRUE, udpTable->table[i].dwLocalAddr, localname, HOSTNAMELEN),
|
||||
GetPortName(flags, udpTable->table[i].dwLocalPort, "tcp", localport, PORTNAMELEN));
|
||||
printf("%4s", "[UDP]");
|
||||
printf(" Local: %s\n Remote: %s\n", localaddr, "*.*.*.*:*");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Diagnostic Trace
|
||||
//
|
||||
#include <stdio.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
||||
@@ -306,10 +306,10 @@ BOOL Setup(VOID)
|
||||
PHOSTENT phe;
|
||||
|
||||
wVersionRequested = MAKEWORD(2, 2);
|
||||
|
||||
|
||||
Status = WSAStartup(wVersionRequested, &WsaData);
|
||||
if (Status != 0) {
|
||||
printf("Could not initialize winsock dll.\n");
|
||||
printf("Could not initialize winsock dll.\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -327,9 +327,9 @@ BOOL Setup(VOID)
|
||||
if (phe == NULL) {
|
||||
printf("Unknown host %s.\n", TargetName);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (phe != NULL) {
|
||||
CopyMemory(&Target.sin_addr, phe->h_addr, phe->h_length);
|
||||
} else {
|
||||
@@ -341,7 +341,7 @@ BOOL Setup(VOID)
|
||||
} else {
|
||||
Target.sin_family = AF_INET;
|
||||
}
|
||||
|
||||
|
||||
TargetIP = inet_ntoa(Target.sin_addr);
|
||||
CurrentSeqNum = 0;
|
||||
SentCount = 0;
|
||||
@@ -390,7 +390,7 @@ VOID TimeToMsString(LPSTR String, LARGE_INTEGER Time)
|
||||
LARGE_INTEGER LargeTime;
|
||||
|
||||
LargeTime.QuadPart = Time.QuadPart / TicksPerMs.QuadPart;
|
||||
|
||||
|
||||
_i64toa(LargeTime.QuadPart, Convstr, 10);
|
||||
strcpy(String, Convstr);
|
||||
strcat(String, "ms");
|
||||
@@ -448,7 +448,7 @@ BOOL DecodeResponse(PCHAR buffer, UINT size, PSOCKADDR_IN from)
|
||||
}
|
||||
|
||||
|
||||
printf("Reply from %s: bytes=%d time%s%s TTL=%d\n", inet_ntoa(from->sin_addr),
|
||||
printf("Reply from %s: bytes=%d time%s%s TTL=%d\n", inet_ntoa(from->sin_addr),
|
||||
size - IphLength - sizeof(ICMP_ECHO_PACKET), Sign, Time, IpHeader->TTL);
|
||||
if (RelativeTime.QuadPart < MinRTT.QuadPart) {
|
||||
MinRTT.QuadPart = RelativeTime.QuadPart;
|
||||
@@ -466,7 +466,7 @@ BOOL Ping(VOID)
|
||||
{
|
||||
INT Status;
|
||||
SOCKADDR From;
|
||||
UINT Length;
|
||||
INT Length;
|
||||
PVOID Buffer;
|
||||
UINT Size;
|
||||
PICMP_ECHO_PACKET Packet;
|
||||
@@ -585,7 +585,7 @@ int main(int argc, char* argv[])
|
||||
|
||||
printf("\nPinging %s [%s] with %d bytes of data:\n\n",
|
||||
TargetName, TargetIP, DataSize);
|
||||
|
||||
|
||||
Count = 0;
|
||||
while ((NeverStop) || (Count < PingCount)) {
|
||||
Ping();
|
||||
|
||||
@@ -25,7 +25,7 @@ public:
|
||||
CListNode *GetPrev();
|
||||
private:
|
||||
PVOID Element;
|
||||
CListNode *Next;
|
||||
CListNode *Next;
|
||||
CListNode *Prev;
|
||||
static HANDLE hHeap;
|
||||
static INT nRef;
|
||||
@@ -37,7 +37,7 @@ public:
|
||||
CList();
|
||||
~CList();
|
||||
CList& operator=(CList&);
|
||||
|
||||
|
||||
CIterator<Item> *CreateIterator() const;
|
||||
LONG Count() const;
|
||||
Item& Get(const LONG index) const;
|
||||
@@ -82,7 +82,7 @@ CList<Item>::CList()
|
||||
// Default destructor
|
||||
template <class Item>
|
||||
CList<Item>::~CList()
|
||||
{
|
||||
{
|
||||
RemoveAll();
|
||||
delete Trailer;
|
||||
delete Header;
|
||||
@@ -157,7 +157,7 @@ VOID CList<Item>::RemoveAll()
|
||||
tmp = node->GetNext();
|
||||
delete node;
|
||||
node = tmp;
|
||||
}
|
||||
}
|
||||
Header->SetNext(Trailer);
|
||||
Trailer->SetPrev(Header);
|
||||
NodeCount = 0;
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#define IN_ADDR_OF(x) *((struct in_addr *)&(x))
|
||||
|
||||
int usage() {
|
||||
fprintf( stderr,
|
||||
fprintf( stderr,
|
||||
"route usage:\n"
|
||||
"route print\n"
|
||||
" prints the route table\n"
|
||||
@@ -45,7 +45,7 @@ int print_routes() {
|
||||
}
|
||||
|
||||
if( Error == ERROR_SUCCESS ) {
|
||||
printf( "%-16s%-16s%-16s%-10s%-10s\n",
|
||||
printf( "%-16s%-16s%-16s%-10s%-10s\n",
|
||||
"Destination",
|
||||
"Netmask",
|
||||
"Gateway",
|
||||
@@ -79,7 +79,7 @@ int print_routes() {
|
||||
}
|
||||
}
|
||||
|
||||
int convert_add_cmd_line( PMIB_IPFORWARDROW RowToAdd,
|
||||
int convert_add_cmd_line( PMIB_IPFORWARDROW RowToAdd,
|
||||
int argc, char **argv ) {
|
||||
int i;
|
||||
|
||||
@@ -105,7 +105,7 @@ int add_route( int argc, char **argv ) {
|
||||
DWORD Error;
|
||||
|
||||
if( argc < 2 || !convert_add_cmd_line( &RowToAdd, argc, argv ) ) {
|
||||
fprintf( stderr,
|
||||
fprintf( stderr,
|
||||
"route add usage:\n"
|
||||
"route add <target> [mask <mask>] <gw> [metric <m>]\n"
|
||||
" Adds a route to the IP route table.\n"
|
||||
@@ -115,10 +115,10 @@ int add_route( int argc, char **argv ) {
|
||||
" <m> is the metric to use (lower is preferred)\n" );
|
||||
return 1;
|
||||
}
|
||||
|
||||
if( (Error = CreateIpForwardEntry( &RowToAdd )) == ERROR_SUCCESS )
|
||||
|
||||
if( (Error = CreateIpForwardEntry( &RowToAdd )) == ERROR_SUCCESS )
|
||||
return 0;
|
||||
|
||||
|
||||
fprintf( stderr, "Route addition failed\n" );
|
||||
return Error;
|
||||
}
|
||||
@@ -128,7 +128,7 @@ int del_route( int argc, char **argv ) {
|
||||
DWORD Error;
|
||||
|
||||
if( argc < 2 || !convert_add_cmd_line( &RowToDel, argc, argv ) ) {
|
||||
fprintf( stderr,
|
||||
fprintf( stderr,
|
||||
"route delete usage:\n"
|
||||
"route delete <target> <gw>\n"
|
||||
" Removes a route from the IP route table.\n"
|
||||
@@ -136,21 +136,21 @@ int del_route( int argc, char **argv ) {
|
||||
" <gw> is the gateway to remove the route from.\n" );
|
||||
return 1;
|
||||
}
|
||||
|
||||
if( (Error = DeleteIpForwardEntry( &RowToDel )) == ERROR_SUCCESS )
|
||||
|
||||
if( (Error = DeleteIpForwardEntry( &RowToDel )) == ERROR_SUCCESS )
|
||||
return 0;
|
||||
|
||||
|
||||
fprintf( stderr, "Route addition failed\n" );
|
||||
return Error;
|
||||
}
|
||||
|
||||
int main( int argc, char **argv ) {
|
||||
if( argc < 2 ) return usage();
|
||||
else if( !strcasecmp( argv[1], "print" ) )
|
||||
else if( !strcasecmp( argv[1], "print" ) )
|
||||
return print_routes();
|
||||
else if( !strcasecmp( argv[1], "add" ) )
|
||||
else if( !strcasecmp( argv[1], "add" ) )
|
||||
return add_route( argc-2, argv+2 );
|
||||
else if( !strcasecmp( argv[1], "delete" ) )
|
||||
else if( !strcasecmp( argv[1], "delete" ) )
|
||||
return del_route( argc-2, argv+2 );
|
||||
else return usage();
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@
|
||||
#define MSG_WSANO_DATA 0x2AFC
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 101
|
||||
|
||||
@@ -53,6 +53,8 @@
|
||||
#include <string.h>
|
||||
#include "ansiprsr.h"
|
||||
|
||||
const int ANSIColors[] = {BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE};
|
||||
|
||||
// The constructor now takes different arguments and initializes different
|
||||
// variables (Paul Brannan 6/15/98)
|
||||
TANSIParser::TANSIParser(TConsole &RefConsole, KeyTranslator &RefKeyTrans,
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
// added this color table to make things go faster (Paul Branann 5/8/98)
|
||||
enum Colors {BLACK=0, BLUE, GREEN, CYAN, RED, MAGENTA, YELLOW, WHITE};
|
||||
static const int ANSIColors[] = {BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE};
|
||||
extern const int ANSIColors[];
|
||||
|
||||
// This should be greater than the largest conceivable window size
|
||||
// 200 should suffice
|
||||
@@ -49,7 +49,7 @@ private:
|
||||
void SaveCurY(int iY);
|
||||
|
||||
void resetTabStops();
|
||||
|
||||
|
||||
int iSavedCurX;
|
||||
int iSavedCurY;
|
||||
unsigned char iSavedAttributes;
|
||||
@@ -77,7 +77,7 @@ public:
|
||||
TANSIParser(TConsole &Console, KeyTranslator &RefKeyTrans,
|
||||
TScroller &RefScroller, TNetwork &NetHandler, TCharmap &RefCharmap);
|
||||
~TANSIParser();
|
||||
|
||||
|
||||
char* ParseBuffer(char* pszBuffer, char* pszBufferEnd);
|
||||
static int StripBuffer(char* pszBuffer, char* pszBufferEnd, int width);
|
||||
};
|
||||
|
||||
@@ -93,5 +93,5 @@ private:
|
||||
int currentKeyMap, mainKeyMap; // AVS
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // __KEYTRANS_H
|
||||
|
||||
@@ -29,36 +29,36 @@ public:
|
||||
growable(delta),
|
||||
lowerbound(lower)
|
||||
{ vector<T>::reserve(upper-lower + 1);}
|
||||
|
||||
|
||||
~TArrayAsVector( )
|
||||
{ // This call is unnecessary? (Paul Brannan 5/7/98)
|
||||
// vector<T>::~vector( );
|
||||
}
|
||||
|
||||
|
||||
int Add(const T& item)
|
||||
{ if(!growable && vector<T>::size( ) == vector<T>::capacity( ))
|
||||
return 0;
|
||||
else
|
||||
insert(vector<T>::end( ), item);
|
||||
return 1; }
|
||||
|
||||
|
||||
int AddAt(const T& item, size_type index)
|
||||
{ if(!growable &&
|
||||
((vector<T>::size( ) == vector<T>::capacity( )) ||
|
||||
(ZeroBase(index > vector<T>::capacity( )) )))
|
||||
return 0;
|
||||
if(ZeroBase(index) > vector<T>::capacity( )) // out of bounds
|
||||
{ insert(vector<T>::end( ),
|
||||
{ insert(vector<T>::end( ),
|
||||
ZeroBase(index) - vector<T>::size( ), T( ));
|
||||
insert(vector<T>::end( ), item); }
|
||||
else
|
||||
{ insert(vector<T>::begin( ) + ZeroBase(index), item); }
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
size_type ArraySize( )
|
||||
{ return vector<T>::capacity( ); }
|
||||
|
||||
|
||||
size_type BoundBase(size_type location) const
|
||||
{ if(location == UINT_MAX)
|
||||
return INT_MAX;
|
||||
@@ -66,44 +66,44 @@ public:
|
||||
return location + lowerbound; }
|
||||
void Detach(size_type index)
|
||||
{ erase(vector<T>::begin( ) + ZeroBase(index)); }
|
||||
|
||||
|
||||
void Detach(const T& item)
|
||||
{ Destroy(Find(item)); }
|
||||
|
||||
|
||||
void Destroy(size_type index)
|
||||
{ erase(vector<T>::begin( ) + ZeroBase(index)); }
|
||||
|
||||
|
||||
void Destroy(const T& item)
|
||||
{ Destroy(Find(item)); }
|
||||
|
||||
|
||||
size_type Find(const T& item) const
|
||||
{ const_iterator location = find(vector<T>::begin( ),
|
||||
{ const_iterator location = find(vector<T>::begin( ),
|
||||
vector<T>::end( ), item);
|
||||
if(location != vector<T>::end( ))
|
||||
return BoundBase(size_type(location -
|
||||
return BoundBase(size_type(location -
|
||||
vector<T>::begin( )));
|
||||
else
|
||||
return INT_MAX; }
|
||||
|
||||
|
||||
size_type GetItemsInContainer( )
|
||||
{ return vector<T>::size( ); }
|
||||
|
||||
|
||||
void Grow(size_type index)
|
||||
{ if( index < lowerbound )
|
||||
Reallocate(ArraySize( ) + (index -
|
||||
Reallocate(ArraySize( ) + (index -
|
||||
lowerbound));
|
||||
else if( index >= BoundBase(vector<T>::size( )))
|
||||
Reallocate(ZeroBase(index) ); }
|
||||
|
||||
|
||||
int HasMember(const T& item)
|
||||
{ if(Find(item) != INT_MAX)
|
||||
return 1;
|
||||
else
|
||||
return 0; }
|
||||
|
||||
|
||||
int IsEmpty( )
|
||||
{ return vector<T>::empty( ); }
|
||||
|
||||
|
||||
int IsFull( )
|
||||
{ if(growable)
|
||||
return 0;
|
||||
@@ -111,42 +111,42 @@ public:
|
||||
return 1;
|
||||
else
|
||||
return 0; }
|
||||
|
||||
|
||||
size_type LowerBound( )
|
||||
{ return lowerbound; }
|
||||
|
||||
|
||||
T& operator[] (size_type index)
|
||||
{ return vector<T>::
|
||||
operator[](ZeroBase(index)); }
|
||||
|
||||
|
||||
const T& operator[] (size_type index) const
|
||||
{ return vector<T>::
|
||||
operator[](ZeroBase(index)); }
|
||||
|
||||
|
||||
void Flush( )
|
||||
{
|
||||
vector<T>::clear();
|
||||
}
|
||||
|
||||
void Reallocate(size_type sz,
|
||||
|
||||
void Reallocate(size_type sz,
|
||||
size_type offset = 0)
|
||||
{ if(offset)
|
||||
insert(vector<T>::begin( ), offset, T( ));
|
||||
vector<T>::reserve(sz);
|
||||
erase(vector<T>::end( ) - offset, vector<T>::end( )); }
|
||||
|
||||
|
||||
void RemoveEntry(size_type index)
|
||||
{ Detach(index); }
|
||||
|
||||
|
||||
void SetData(size_type index, const T& item)
|
||||
{ (*this)[index] = item; }
|
||||
|
||||
|
||||
size_type UpperBound( )
|
||||
{ return BoundBase(vector<T>::capacity( )) - 1; }
|
||||
|
||||
|
||||
size_type ZeroBase(size_type index) const
|
||||
{ return index - lowerbound; }
|
||||
|
||||
|
||||
// The assignment operator is not inherited (Paul Brannan 5/25/98)
|
||||
TArrayAsVector& operator=(const TArrayAsVector& v) {
|
||||
vector<T>::operator=(v);
|
||||
|
||||
@@ -25,9 +25,9 @@
|
||||
* | . | | |
|
||||
* | . | <-- OR --> | |
|
||||
* | . | | |
|
||||
* CON_LEFT | . | CON_RIGHT |
|
||||
* CON_LEFT | . | CON_RIGHT |
|
||||
* (=0) | . | (=CON_ | CON_LINES
|
||||
* |..............* | WIDTH) |
|
||||
* |..............* | WIDTH) |
|
||||
* | (CON_CUR_X, | | |
|
||||
* | CON_CUR_Y) | | |
|
||||
* | | | |
|
||||
@@ -77,15 +77,15 @@ public:
|
||||
void SetCursorPosition(int x, int y);
|
||||
void SetCursorSize(int pct);
|
||||
void MoveCursorPosition(int x, int y);
|
||||
|
||||
|
||||
// Screen mode/size routines
|
||||
int GetWidth() {return CON_COLS;}
|
||||
int GetHeight() {return CON_LINES;}
|
||||
void SetExtendedMode(int iFunction, BOOL bEnable);
|
||||
void SetWindowSize(int width, int height); // Set the size of the window,
|
||||
// but not the buffer
|
||||
|
||||
// Color/attribute routines
|
||||
|
||||
// Color/attribute routines
|
||||
void SetAttrib(unsigned char wAttr) {wAttributes = wAttr;}
|
||||
unsigned char GetAttrib() {return wAttributes;}
|
||||
void Normal(); // Reset all attributes
|
||||
@@ -130,13 +130,13 @@ public:
|
||||
void index();
|
||||
void reverse_index();
|
||||
void setLineWrap(bool bEnabled){
|
||||
if(!ini.get_lock_linewrap())
|
||||
if(!ini.get_lock_linewrap())
|
||||
ini.set_value("Wrap_Line", bEnabled ? "true" : "false");
|
||||
}
|
||||
bool getLineWrap() {return ini.get_wrapline();}
|
||||
|
||||
// Insert/delete characters/lines
|
||||
void InsertLine(int numlines); // Added by Titus von Boxberg 30/3/97
|
||||
void InsertLine(int numlines); // Added by Titus von Boxberg 30/3/97
|
||||
void InsertCharacter(int numchar); // "
|
||||
void DeleteCharacter(int numchar); // "
|
||||
void InsertMode(int i) {insert_mode = i;}
|
||||
@@ -148,7 +148,7 @@ protected:
|
||||
HANDLE hConsole;
|
||||
|
||||
CONSOLE_SCREEN_BUFFER_INFO ConsoleInfo;
|
||||
|
||||
|
||||
unsigned char wAttributes;
|
||||
unsigned char fg, bg;
|
||||
unsigned char defaultfg, defaultbg;
|
||||
@@ -157,7 +157,7 @@ protected:
|
||||
bool blink;
|
||||
bool underline;
|
||||
bool reverse;
|
||||
|
||||
|
||||
int iScrollStart;
|
||||
int iScrollEnd;
|
||||
int insert_mode;
|
||||
|
||||
@@ -39,20 +39,20 @@ private:
|
||||
KeyDefType uKeyDef;
|
||||
DWORD vk_code;
|
||||
DWORD dwState;
|
||||
|
||||
|
||||
public:
|
||||
TKeyDef();
|
||||
TKeyDef(char *def, DWORD state, DWORD code);
|
||||
TKeyDef(optype op, DWORD state, DWORD code);
|
||||
TKeyDef(const TKeyDef &t);
|
||||
|
||||
|
||||
char *operator=(char *def);
|
||||
DWORD operator=(DWORD code);
|
||||
TKeyDef& operator=(const TKeyDef &t);
|
||||
const optype& operator=(optype op);
|
||||
|
||||
|
||||
~TKeyDef();
|
||||
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
int operator==(TKeyDef &t);
|
||||
#else
|
||||
@@ -61,7 +61,7 @@ public:
|
||||
friend bool operator==(const TKeyDef &t1, const TKeyDef &t2);
|
||||
friend bool operator<(const TKeyDef &t1, const TKeyDef &t2);
|
||||
#endif
|
||||
|
||||
|
||||
const char *GetszKey() { return uKeyDef.szKeyDef; }
|
||||
const KeyDefType GetKeyDef() { return uKeyDef; }
|
||||
DWORD GetCodeKey() { return vk_code; }
|
||||
|
||||
@@ -26,7 +26,7 @@ public:
|
||||
int Open(const char *szHost, const char *strPort = "23");
|
||||
int Close(); // close current connection
|
||||
int Resume(); // resume current session
|
||||
|
||||
|
||||
// changes to the keymap profile in the file
|
||||
int LoadKeyMap( const char * file, const char * name);
|
||||
void DisplayKeyMap(); // display available keymaps
|
||||
@@ -35,7 +35,7 @@ private:
|
||||
SOCKET Connect();
|
||||
void telSetConsoleTitle(const char * szHost);
|
||||
void DoInit();
|
||||
|
||||
|
||||
SOCKET Socket;
|
||||
char strPort[32]; // int iPort;
|
||||
char szHost[127];
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#define __TNMISC_H
|
||||
|
||||
// Process-related functions
|
||||
BOOL CreateHiddenConsoleProcess(LPCTSTR szChildName, PROCESS_INFORMATION* ppi,
|
||||
BOOL CreateHiddenConsoleProcess(LPCTSTR szChildName, PROCESS_INFORMATION* ppi,
|
||||
LPHANDLE phInWrite, LPHANDLE phOutRead,
|
||||
LPHANDLE phErrRead);
|
||||
BOOL SpawnProcess(char *cmd_line, PROCESS_INFORMATION *pi);
|
||||
|
||||
@@ -97,7 +97,7 @@
|
||||
#define MSG_WSANO_DATA 0x2AFC
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 101
|
||||
|
||||
@@ -222,7 +222,7 @@ static char sccsid[] = "@(#)traceroute.c 8.1 (Berkeley) 6/6/93";
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
#include <winsock2.h>
|
||||
|
||||
|
||||
@@ -508,7 +508,7 @@ main(argc, argv)
|
||||
|
||||
status = WSAStartup(MAKEWORD(2, 2), &wsadata);
|
||||
if (status != 0) {
|
||||
printf("Could not initialize winsock dll.\n");
|
||||
printf("Could not initialize winsock dll.\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -83,10 +83,10 @@ int main(int argc, char **argv)
|
||||
if (!argc)
|
||||
usage();
|
||||
|
||||
/* Start winsock */
|
||||
/* Start winsock */
|
||||
wVersionRequested = MAKEWORD( 1, 1 );
|
||||
err = WSAStartup( wVersionRequested, &wsaData );
|
||||
if ( err != 0 )
|
||||
if ( err != 0 )
|
||||
{
|
||||
/* Tell the user that we couldn't find a usable */
|
||||
/* WinSock DLL. */
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
/* $Id$
|
||||
*
|
||||
*
|
||||
* Convert NTSTATUS codes to Win32 error codes: run it
|
||||
* on a NT box AND on a ROS box, then diff the results.
|
||||
*
|
||||
* This utility should help keeping correct how Ros
|
||||
* translates executive's errors codes into Win32 error
|
||||
* codes.
|
||||
*
|
||||
*
|
||||
* Usage: nts2w32err [MaxStatusCode] > log.txt
|
||||
*
|
||||
*
|
||||
* 2004-01-10 Emanuele Aliberti
|
||||
*
|
||||
*
|
||||
*/
|
||||
#include <ddk/ntddk.h>
|
||||
#include <windows.h>
|
||||
|
||||
@@ -35,7 +35,7 @@ RawUszAsz (
|
||||
)
|
||||
{
|
||||
register PCHAR a = szA;
|
||||
|
||||
|
||||
while (*szU) {*szA++ = (CHAR) (0x00ff & * szU++);}
|
||||
*szA = '\0';
|
||||
return a;
|
||||
@@ -51,7 +51,7 @@ RawAszUsz (
|
||||
)
|
||||
{
|
||||
register PWCHAR w = szW;
|
||||
|
||||
|
||||
while (*szA) {*szW++ = (WCHAR) *szA++;}
|
||||
*szW = L'\0';
|
||||
return w;
|
||||
@@ -64,7 +64,7 @@ STDCALL
|
||||
StatusToName (NTSTATUS Status)
|
||||
{
|
||||
static char RawValue [16];
|
||||
|
||||
|
||||
switch (Status)
|
||||
{
|
||||
case STATUS_BUFFER_TOO_SMALL:
|
||||
@@ -112,7 +112,7 @@ ExpandSymbolicLink (
|
||||
Path.Buffer = PathBuffer;
|
||||
Path.Length = 0;
|
||||
Path.MaximumLength = sizeof PathBuffer;
|
||||
|
||||
|
||||
RtlCopyUnicodeString (& Path, DirectoryName);
|
||||
if (L'\\' != Path.Buffer [(Path.Length / sizeof Path.Buffer[0]) - 1])
|
||||
{
|
||||
@@ -183,7 +183,7 @@ ListDirectory (
|
||||
ULONG Context = 0;
|
||||
ULONG ReturnLength = 0;
|
||||
ULONG EntryCount = 0;
|
||||
|
||||
|
||||
/* For expanding symbolic links */
|
||||
WCHAR TargetName [2 * MAX_PATH];
|
||||
UNICODE_STRING TargetObjectName = {
|
||||
@@ -222,7 +222,7 @@ ListDirectory (
|
||||
return (FALSE);
|
||||
}
|
||||
printf ("\n Directory of %s\n\n", DirectoryNameA);
|
||||
|
||||
|
||||
for(;;)
|
||||
{
|
||||
/*
|
||||
@@ -355,7 +355,7 @@ int main(int argc, char* argv[])
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
RawAszUsz (argv[2], DirectoryNameW);
|
||||
Recurse = TRUE;
|
||||
Recurse = TRUE;
|
||||
break;
|
||||
default:
|
||||
fprintf (
|
||||
|
||||
@@ -59,7 +59,7 @@ main(int argc, char *argv[])
|
||||
if (NULL == Buffer)
|
||||
{
|
||||
perror("Can't allocate buffer");
|
||||
fclose(File);
|
||||
fclose(File);
|
||||
exit(1);
|
||||
}
|
||||
rewind(File);
|
||||
@@ -67,7 +67,7 @@ main(int argc, char *argv[])
|
||||
{
|
||||
perror("Error reading from original file");
|
||||
free(Buffer);
|
||||
fclose(File);
|
||||
fclose(File);
|
||||
exit(1);
|
||||
}
|
||||
fclose(File);
|
||||
@@ -97,7 +97,7 @@ main(int argc, char *argv[])
|
||||
if (Size != fwrite(Buffer, 1, Size, File))
|
||||
{
|
||||
perror("Error writing to output file");
|
||||
fclose(File);
|
||||
fclose(File);
|
||||
remove(TempName);
|
||||
free(Buffer);
|
||||
exit(1);
|
||||
|
||||
@@ -60,7 +60,7 @@ int main(int argc, char **argv)
|
||||
if (!((PIMAGE_SECTION_HEADER)IMAGE_FIRST_SECTION((PIMAGE_NT_HEADERS)&buffer[offset]))[i].VirtualAddress)
|
||||
break;
|
||||
#if 1
|
||||
printf("%-8.8s %08x %08x %08x ",
|
||||
printf("%-8.8s %08x %08x %08x ",
|
||||
((PIMAGE_SECTION_HEADER)IMAGE_FIRST_SECTION((PIMAGE_NT_HEADERS)&buffer[offset]))[i].Name,
|
||||
((PIMAGE_SECTION_HEADER)IMAGE_FIRST_SECTION((PIMAGE_NT_HEADERS)&buffer[offset]))[i].VirtualAddress,
|
||||
((PIMAGE_SECTION_HEADER)IMAGE_FIRST_SECTION((PIMAGE_NT_HEADERS)&buffer[offset]))[i].SizeOfRawData,
|
||||
|
||||
@@ -7,7 +7,7 @@ Module Name:
|
||||
termínal.h
|
||||
|
||||
Abstract:
|
||||
|
||||
|
||||
HEADER for terminal.c
|
||||
|
||||
Environment:
|
||||
@@ -21,7 +21,7 @@ Author:
|
||||
Revision History:
|
||||
|
||||
23-Jan-2001: created
|
||||
|
||||
|
||||
Copyright notice:
|
||||
|
||||
This file may be distributed under the terms of the GNU Public License.
|
||||
|
||||
@@ -15,7 +15,7 @@ Environment:
|
||||
LINUX 2.2.X
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2000-2001 Goran Devic
|
||||
Copyright (c) 2000-2001 Goran Devic
|
||||
Modified (c) 2001 Klaus P. Gerlicher
|
||||
|
||||
Module Name:
|
||||
@@ -16,15 +16,15 @@ Environment:
|
||||
LINUX 2.2.X
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Goran Devic
|
||||
Goran Devic
|
||||
|
||||
Revision History:
|
||||
|
||||
17-Mar-2000: Original (Goran Devic)
|
||||
17-Mar-2000: Original (Goran Devic)
|
||||
26-Apr-2000: Major rewrite, added coprocessor instructions (Goran Devic)
|
||||
04-Nov-2000: Modified for LinIce (Goran Devic)
|
||||
04-Nov-2000: Modified for LinIce (Goran Devic)
|
||||
05-Jan-2001: Modified for pICE (Klaus P. Gerlicher)
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ static UCHAR GetNextUCHAR(USHORT sel, UCHAR *offset, UCHAR *pCode)
|
||||
pCode[0] = GetUCHAR((ULONG) offset + 0) & 0xFF;
|
||||
|
||||
return( pCode[0] );
|
||||
}
|
||||
}
|
||||
|
||||
static USHORT GetNextUSHORT(USHORT sel, UCHAR *offset, UCHAR *pCode)
|
||||
{
|
||||
@@ -118,7 +118,7 @@ static USHORT GetNextUSHORT(USHORT sel, UCHAR *offset, UCHAR *pCode)
|
||||
pCode[1] = GetUCHAR((ULONG) offset + 1) & 0xFF;
|
||||
|
||||
return( *(USHORT *) pCode );
|
||||
}
|
||||
}
|
||||
|
||||
static ULONG GetNextULONG(USHORT sel, UCHAR *offset, UCHAR *pCode)
|
||||
{
|
||||
@@ -128,7 +128,7 @@ static ULONG GetNextULONG(USHORT sel, UCHAR *offset, UCHAR *pCode)
|
||||
pCode[3] = GetUCHAR((ULONG) offset + 3) & 0xFF;
|
||||
|
||||
return( *(ULONG *) pCode );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#define NEXTUCHAR GetNextUCHAR( pDis->wSel, bpTarget, bpCode); bpCode += 1; bpTarget += 1; bInstrLen += 1
|
||||
@@ -705,7 +705,7 @@ DisEnd:
|
||||
BOOLEAN Disasm(PULONG pOffset,PUCHAR pchDst)
|
||||
{
|
||||
TDisassembler dis;
|
||||
|
||||
|
||||
dis.dwFlags = DIS_DATA32 | DIS_ADDRESS32;
|
||||
dis.bpTarget = (UCHAR*)*pOffset;
|
||||
dis.szDisasm = pchDst;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#define OP_BPTR 0x400 /* BYTE Pointer */
|
||||
#define OP_WPTR 0x500 /* WORD Pointer */
|
||||
#define OP_DPTR 0x600 /* DWORD Pointer */
|
||||
#define OP_UNK 0x900
|
||||
#define OP_UNK 0x900
|
||||
//#define INS_INVALID 0x00 /* Not a valid instruction */
|
||||
/* Branch Instruction types */
|
||||
#define INS_BRANCH 0x01 /* Unconditional branch */
|
||||
@@ -94,7 +94,7 @@ enum argtype {
|
||||
ARG_REG_IY_IND,ARG_REG_C_IND,ARG_REG_I,ARG_REG_R,ARG_IMM16_A,ARG_MODRM16,ARG_SIMM8,
|
||||
ARG_IMM32,ARG_STRING,ARG_MODRM_BCD,ARG_PSTRING,ARG_DOSSTRING,ARG_CUNICODESTRING,
|
||||
ARG_PUNICODESTRING,ARG_NONEBYTE,ARG_XREG,ARG_XMMMODRM};
|
||||
|
||||
|
||||
typedef struct x86_inst {
|
||||
int flags;
|
||||
int destType, srcType, auxType;
|
||||
@@ -122,7 +122,7 @@ typedef struct x86_inst {
|
||||
#define DISP8 0x1000
|
||||
#define DISP32 0x2000
|
||||
#define HAS_SIB 0x4000
|
||||
#define HAS_MODRM 0x8000
|
||||
#define HAS_MODRM 0x8000
|
||||
|
||||
struct OPERAND { //arg1, arg2, arg3
|
||||
char * str; //temporary buffer for building arg text
|
||||
@@ -138,7 +138,7 @@ struct EA { //effective address [SIB/disp]
|
||||
char sib[32];
|
||||
};
|
||||
|
||||
struct modRM_byte {
|
||||
struct modRM_byte {
|
||||
unsigned int mod : 2;
|
||||
unsigned int reg : 3;
|
||||
unsigned int rm : 3;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2000-2001 Goran Devic
|
||||
Copyright (c) 2000-2001 Goran Devic
|
||||
Modified (c) 2001 Klaus P. Gerlicher
|
||||
|
||||
Module Name:
|
||||
@@ -16,13 +16,13 @@ Environment:
|
||||
LINUX 2.2.X
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Goran Devic
|
||||
Goran Devic
|
||||
|
||||
Revision History:
|
||||
|
||||
17-Mar-2000: Original (Goran Devic)
|
||||
17-Mar-2000: Original (Goran Devic)
|
||||
05-Jan-2001: Modified for pICE (Klaus P. Gerlicher)
|
||||
|
||||
Copyright notice:
|
||||
|
||||
@@ -15,7 +15,7 @@ Environment:
|
||||
LINUX 2.2.X
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ Environment:
|
||||
LINUX 2.2.X
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ Environment:
|
||||
LINUX 2.2.X
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
@@ -28,7 +28,7 @@ Copyright notice:
|
||||
This file may be distributed under the terms of the GNU Public License.
|
||||
|
||||
--*/
|
||||
void DeinstallHooks(void);
|
||||
void DeinstallHooks(void);
|
||||
//ULONG HookInt(ULONG dwInt,ULONG NewIntHandler);
|
||||
//void UnhookInt(ULONG dwInt);
|
||||
void MaskIrqs(void);
|
||||
|
||||
@@ -15,7 +15,7 @@ Environment:
|
||||
LINUX 2.2.X
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
@@ -29,7 +29,7 @@ Copyright notice:
|
||||
|
||||
--*/
|
||||
|
||||
BOOLEAN InitPICE(void);
|
||||
void CleanUpPICE(void);
|
||||
BOOLEAN InitPICE(void);
|
||||
void CleanUpPICE(void);
|
||||
|
||||
extern char szBootParams[1024];
|
||||
|
||||
@@ -15,7 +15,7 @@ Environment:
|
||||
LINUX 2.2.X
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ Environment:
|
||||
LINUX 2.2.X
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ Environment:
|
||||
LINUX 2.2.X
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
@@ -33,4 +33,4 @@ Copyright notice:
|
||||
#define PICE_MINOR_VERSION (99)
|
||||
// reset this on major or minor version change
|
||||
// increment this on every release build
|
||||
#define PICE_BUILD (0007)
|
||||
#define PICE_BUILD (0007)
|
||||
|
||||
@@ -15,7 +15,7 @@ Environment:
|
||||
LINUX 2.2.X
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ Environment:
|
||||
LINUX 2.2.X
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ Environment:
|
||||
LINUX 2.2.X
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ Environment:
|
||||
LINUX 2.2.X
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
@@ -32,5 +32,5 @@ void SendString(LPSTR s);
|
||||
void SetupSerial(ULONG port,ULONG baudrate);
|
||||
|
||||
BOOLEAN ConsoleInitSerial(void);
|
||||
void ConsoleShutdownSerial(void);
|
||||
void ConsoleShutdownSerial(void);
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ Environment:
|
||||
LINUX 2.2.X
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ Environment:
|
||||
LINUX 2.2.X
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
|
||||
@@ -2035,7 +2035,7 @@ PICE_SYMBOLFILE_HEADER* LoadSymbols(LPSTR filename)
|
||||
if(pSymbols->magic == PICE_MAGIC)
|
||||
{
|
||||
DPRINT((0,"magic = %X\n",pSymbols->magic));
|
||||
DPRINT((0,"name = %S\n",pSymbols->name));;
|
||||
DPRINT((0,"name = %S\n",pSymbols->name));
|
||||
DPRINT((0,"ulOffsetToHeaders,ulSizeOfHeader = %X,%X\n",pSymbols->ulOffsetToHeaders,pSymbols->ulSizeOfHeader));
|
||||
DPRINT((0,"ulOffsetToGlobals,ulSizeOfGlobals = %X,%X\n",pSymbols->ulOffsetToGlobals,pSymbols->ulSizeOfGlobals));
|
||||
DPRINT((0,"ulOffsetToGlobalsStrings,ulSizeOfGlobalsStrings = %X,%X\n",pSymbols->ulOffsetToGlobalsStrings,pSymbols->ulSizeOfGlobalsStrings));
|
||||
|
||||
@@ -15,7 +15,7 @@ Environment:
|
||||
LINUX 2.2.X
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ Environment:
|
||||
LINUX 2.2.X
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ Environment:
|
||||
LINUX 2.2.X
|
||||
Kernel mode only
|
||||
|
||||
Author:
|
||||
Author:
|
||||
|
||||
Klaus P. Gerlicher
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ static char* title2 = "w PID Hwnd WndStile TID WndName\n";
|
||||
struct status {
|
||||
DWORD state;
|
||||
char desc[10];
|
||||
} thread_stat[8 + 1] = {
|
||||
} thread_stat[8 + 1] = {
|
||||
{0, "Init "},
|
||||
{1, "Ready "},
|
||||
{2, "Running "},
|
||||
@@ -51,7 +51,7 @@ struct status {
|
||||
struct waitres {
|
||||
DWORD state;
|
||||
char desc[11];
|
||||
} waitreason[28 + 1] = {
|
||||
} waitreason[28 + 1] = {
|
||||
{0, "Executive "},
|
||||
{1, "FreePage "},
|
||||
{2, "PageIn "},
|
||||
@@ -90,9 +90,9 @@ EnumThreadProc(HWND hwnd, LPARAM lp)
|
||||
LONG style;
|
||||
HANDLE stdout = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
char buf[256];
|
||||
|
||||
|
||||
GetWindowText(hwnd, (LPTSTR)lp, 30);
|
||||
|
||||
|
||||
if(hwnd != 0)
|
||||
{
|
||||
style = GetWindowLong(hwnd, GWL_STYLE);
|
||||
@@ -116,7 +116,7 @@ int main()
|
||||
NTSTATUS Status;
|
||||
char buf[256];
|
||||
char buf1[256];
|
||||
|
||||
|
||||
WriteFile(stdout, title, lstrlen(title), &r, NULL);
|
||||
WriteFile(stdout, title1, lstrlen(title1), &r, NULL);
|
||||
WriteFile(stdout, title2, lstrlen(title2), &r, NULL);
|
||||
@@ -153,7 +153,7 @@ int main()
|
||||
hour = (ptime.QuadPart / (10000000LL * 3600LL));
|
||||
minute = (ptime.QuadPart / (10000000LL * 60LL)) % 60LL;
|
||||
seconds = (ptime.QuadPart / 10000000LL) % 60LL;
|
||||
|
||||
|
||||
ptime.QuadPart = CurrentProcess->UserTime.QuadPart;
|
||||
hour1 = (ptime.QuadPart / (10000000LL * 3600LL));
|
||||
minute1 = (ptime.QuadPart / (10000000LL * 60LL)) % 60LL;
|
||||
@@ -166,7 +166,7 @@ int main()
|
||||
hour, minute, seconds, hour1, minute1, seconds1,
|
||||
astring.Buffer);
|
||||
WriteFile(stdout, buf, lstrlen(buf), &r, NULL);
|
||||
|
||||
|
||||
RtlFreeAnsiString(&astring);
|
||||
|
||||
for (ti = 0; ti < CurrentProcess->NumberOfThreads; ti++)
|
||||
@@ -193,7 +193,7 @@ int main()
|
||||
while (waitt->state != CurrentProcess->TH[ti].WaitReason && waitt->state >= 0)
|
||||
waitt++;
|
||||
|
||||
wsprintf (buf1,
|
||||
wsprintf (buf1,
|
||||
"t% %8d %3d:%02d:%02d %3d:%02d:%02d %s %s\n",
|
||||
CurrentProcess->TH[ti].ClientId.UniqueThread,
|
||||
thour, tmin, tsec, thour1, tmin1, tsec1,
|
||||
@@ -206,6 +206,6 @@ int main()
|
||||
}
|
||||
CurrentProcess = (PSYSTEM_PROCESS_INFORMATION)((ULONG_PTR)CurrentProcess +
|
||||
CurrentProcess->NextEntryOffset);
|
||||
}
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -22,13 +22,13 @@
|
||||
*
|
||||
* All Rights Reserved
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software and its
|
||||
* documentation for any purpose and without fee is hereby granted,
|
||||
* Permission to use, copy, modify, and distribute this software and its
|
||||
* documentation for any purpose and without fee is hereby granted,
|
||||
* provided that the above copyright notice appear in all copies and that
|
||||
* both that copyright notice and this permission notice appear in
|
||||
* both that copyright notice and this permission notice appear in
|
||||
* supporting documentation, and that the name of Digital not be
|
||||
* used in advertising or publicity pertaining to distribution of the
|
||||
* software without specific, written prior permission.
|
||||
* software without specific, written prior permission.
|
||||
*
|
||||
* DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
@@ -88,7 +88,7 @@ ClearWindow(PPERF_INFO PerfInfo)
|
||||
UpdateWindow(PerfInfo->Wnd);
|
||||
}
|
||||
|
||||
static unsigned
|
||||
static unsigned
|
||||
CalibrateTest(PTEST Test, PPERF_INFO PerfInfo)
|
||||
{
|
||||
#define GOAL 2500 /* Try to get up to 2.5 seconds */
|
||||
@@ -127,7 +127,7 @@ CalibrateTest(PTEST Test, PPERF_INFO PerfInfo)
|
||||
|
||||
if (DidReps != Reps)
|
||||
{
|
||||
/* The test can't do the number of reps as we asked for.
|
||||
/* The test can't do the number of reps as we asked for.
|
||||
Give up */
|
||||
return DidReps;
|
||||
}
|
||||
@@ -165,7 +165,7 @@ CalibrateTest(PTEST Test, PPERF_INFO PerfInfo)
|
||||
return Reps;
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
DisplayStatus(HWND Label, LPCWSTR Message, LPCWSTR Test, int Try)
|
||||
{
|
||||
WCHAR Status[128];
|
||||
@@ -176,7 +176,7 @@ DisplayStatus(HWND Label, LPCWSTR Message, LPCWSTR Test, int Try)
|
||||
UpdateWindow(Label);
|
||||
}
|
||||
|
||||
static double
|
||||
static double
|
||||
RoundTo3Digits(double d)
|
||||
{
|
||||
/* It's kind of silly to print out things like ``193658.4/sec'' so just
|
||||
@@ -222,7 +222,7 @@ RoundTo3Digits(double d)
|
||||
return d * sign;
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
ReportTimes(DWORD Time, int Reps, LPCWSTR Label, BOOL Average)
|
||||
{
|
||||
double MSecsPerObj, ObjsPerSec;
|
||||
@@ -236,7 +236,7 @@ ReportTimes(DWORD Time, int Reps, LPCWSTR Label, BOOL Average)
|
||||
allow averaging results from several repetitions. */
|
||||
ObjsPerSec = RoundTo3Digits(ObjsPerSec);
|
||||
|
||||
wprintf(L"%7d %s @ %8.4f msec (%8.1f/sec): %s\n",
|
||||
wprintf(L"%7d %s @ %8.4f msec (%8.1f/sec): %s\n",
|
||||
Reps, Average ? L"trep" : L"reps", MSecsPerObj, ObjsPerSec, Label);
|
||||
}
|
||||
else
|
||||
@@ -281,7 +281,7 @@ ProcessTest(PTEST Test, PPERF_INFO PerfInfo)
|
||||
ReportTimes(Time, Reps, Test->Label, FALSE);
|
||||
(*Test->PassCleanup)(Context, PerfInfo);
|
||||
ProcessMessages();
|
||||
}
|
||||
}
|
||||
(*Test->Cleanup)(Context, PerfInfo);
|
||||
ReportTimes(TotalTime, Repeat * Reps, Test->Label, TRUE);
|
||||
ProcessMessages();
|
||||
@@ -367,9 +367,9 @@ PrintOSVersion(void)
|
||||
wprintf(L"Professional ");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Test for the server type. */
|
||||
else if (VER_NT_SERVER == VersionInfo.wProductType ||
|
||||
else if (VER_NT_SERVER == VersionInfo.wProductType ||
|
||||
VER_NT_DOMAIN_CONTROLLER == VersionInfo.wProductType)
|
||||
{
|
||||
if (5 == VersionInfo.dwMajorVersion && 2 == VersionInfo.dwMinorVersion)
|
||||
@@ -460,7 +460,7 @@ PrintOSVersion(void)
|
||||
|
||||
/* Display service pack (if any) and build number. */
|
||||
|
||||
if (4 == VersionInfo.dwMajorVersion &&
|
||||
if (4 == VersionInfo.dwMajorVersion &&
|
||||
0 == lstrcmpiW(VersionInfo.szCSDVersion, L"Service Pack 6"))
|
||||
{
|
||||
/* Test for SP6 versus SP6a. */
|
||||
@@ -500,7 +500,7 @@ PrintOSVersion(void)
|
||||
{
|
||||
wprintf(L"OSR2");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (4 == VersionInfo.dwMajorVersion && 10 == VersionInfo.dwMinorVersion)
|
||||
{
|
||||
@@ -514,7 +514,7 @@ PrintOSVersion(void)
|
||||
else if (4 == VersionInfo.dwMajorVersion && 90 == VersionInfo.dwMinorVersion)
|
||||
{
|
||||
wprintf(L"Running on Microsoft Windows Millennium Edition");
|
||||
}
|
||||
}
|
||||
wprintf(L"\n");
|
||||
break;
|
||||
|
||||
@@ -575,7 +575,7 @@ MainWndProc(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
||||
EndPaint (Wnd, &Ps);
|
||||
Result = 0;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
Result = DefWindowProcW(Wnd, Msg, wParam, lParam);
|
||||
break;
|
||||
@@ -623,7 +623,7 @@ LabelWndProc(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
||||
EndPaint (Wnd, &Ps);
|
||||
Result = 0;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
Result = DefWindowProcW(Wnd, Msg, wParam, lParam);
|
||||
break;
|
||||
@@ -857,7 +857,7 @@ ProcessCommandLine(PPERF_INFO PerfInfo, unsigned *TestCount, PTEST *Tests)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int WINAPI
|
||||
int WINAPI
|
||||
WinMain(HINSTANCE hInstance,
|
||||
HINSTANCE hPrevInstance,
|
||||
LPSTR lpszCmdLine,
|
||||
|
||||
@@ -92,7 +92,7 @@ int sc_command(SC_HANDLE hSCManager, SC_CMDS sc_cmd, char* argv[])
|
||||
return sc_control(hSCManager, argv[0], SERVICE_CONTROL_CONTINUE);
|
||||
case SC_CMD_STOP:
|
||||
return sc_control(hSCManager, argv[0], SERVICE_CONTROL_STOP);
|
||||
|
||||
|
||||
// case SC_CMD_CONFIG:
|
||||
// case SC_CMD_DESCRIPTION:
|
||||
// case SC_CMD_CONTROL:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* ReactOS test program -
|
||||
* ReactOS test program -
|
||||
*
|
||||
* main.h
|
||||
*
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#ifndef _MFC_VER
|
||||
#ifdef _WIN32_WCE
|
||||
|
||||
|
||||
#else//_WIN32_WCE
|
||||
#include <assert.h>
|
||||
#endif//_WIN32_WCE
|
||||
|
||||
@@ -249,7 +249,7 @@ PsaFreeCapture
|
||||
IN PVOID Capture
|
||||
);
|
||||
|
||||
/* The user must define these functions. They are called by PSAPI to allocate
|
||||
/* The user must define these functions. They are called by PSAPI to allocate
|
||||
memory. This allows PSAPI to be called from any environment */
|
||||
void *PsaiMalloc(SIZE_T size);
|
||||
void *PsaiRealloc(void *ptr, SIZE_T size);
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
*/
|
||||
#include <windows.h>
|
||||
#include <tchar.h>
|
||||
#include <stdio.h>
|
||||
#include <stdio.h>
|
||||
|
||||
typedef struct _EXTENSION_INFO
|
||||
{
|
||||
@@ -80,14 +80,14 @@ AddExtension(LPTSTR ExtName,
|
||||
ExtInfo = (PEXTENSION_INFO) HeapAlloc (GetProcessHeap(), 0, sizeof (EXTENSION_INFO));
|
||||
if (!ExtInfo)
|
||||
return NULL;
|
||||
|
||||
|
||||
for(t = ExtName; *t != _T('\0'); t += _tcslen(t) + 1);
|
||||
ln = (DWORD)t - (DWORD)ExtName;
|
||||
|
||||
|
||||
ZeroMemory (ExtInfo, sizeof (EXTENSION_INFO));
|
||||
memcpy (ExtInfo->ExtName, ExtName, ln);
|
||||
_tcscpy (ExtInfo->Description, Description);
|
||||
|
||||
|
||||
for(t = ExtInfo->ExtName; *t != _T('\0'); t += _tcslen(t) + 1)
|
||||
{
|
||||
if(ExtInfo->nExtensions++ != 0)
|
||||
@@ -95,7 +95,7 @@ AddExtension(LPTSTR ExtName,
|
||||
_tcscat (ExtInfo->ExpandedExtName, _T("*."));
|
||||
_tcscat (ExtInfo->ExpandedExtName, t);
|
||||
}
|
||||
|
||||
|
||||
if (ExtInfoList)
|
||||
{
|
||||
Info = ExtInfoList;
|
||||
@@ -201,7 +201,7 @@ ReadLines(PFILE_INFO StatInfo)
|
||||
static char FileBuffer[1024];
|
||||
char LastChar = '\0';
|
||||
char *Current;
|
||||
|
||||
|
||||
LineLen = 0;
|
||||
while(ReadFile (FileHandle, FileBuffer, sizeof(FileBuffer), &ReadBytes, NULL) && ReadBytes >= sizeof(char))
|
||||
{
|
||||
@@ -226,7 +226,7 @@ ReadLines(PFILE_INFO StatInfo)
|
||||
LineLen++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
StatInfo->LineCount += (LineLen > 0);
|
||||
StatInfo->EmptyLines += ((LastChar != '\0') && (LineLen == 0));
|
||||
}
|
||||
@@ -245,16 +245,16 @@ PrintStatistics(VOID)
|
||||
TotalLineCount = 0;
|
||||
TotalEmptyLines = 0;
|
||||
Info = ExtInfoList;
|
||||
|
||||
|
||||
for (Info = ExtInfoList; Info != NULL; Info = Info->Next)
|
||||
{
|
||||
TotalFileCount += Info->FileCount;
|
||||
TotalLineCount += Info->LineCount;
|
||||
TotalEmptyLines += Info->EmptyLines;
|
||||
}
|
||||
|
||||
|
||||
TotalAvgLF = (TotalFileCount ? TotalLineCount / TotalFileCount : 0);
|
||||
|
||||
|
||||
for (Info = ExtInfoList; Info != NULL; Info = Info->Next)
|
||||
{
|
||||
DWORD AvgLF;
|
||||
@@ -325,16 +325,16 @@ ProcessFiles(LPTSTR Path)
|
||||
if (LoadFile (FileName))
|
||||
{
|
||||
PFILE_INFO StatInfo;
|
||||
|
||||
|
||||
StatInfo = AddFile (FindFile.cFileName, Info);
|
||||
if (!StatInfo)
|
||||
{
|
||||
_tprintf (_T("Not enough free memory.\n"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
ReadLines (StatInfo);
|
||||
|
||||
|
||||
Info->FileCount++;
|
||||
Info->LineCount += StatInfo->LineCount;
|
||||
Info->EmptyLines += StatInfo->EmptyLines;
|
||||
@@ -434,7 +434,7 @@ IsOptionSet(TCHAR *Option)
|
||||
{
|
||||
if(!Options[i])
|
||||
continue;
|
||||
|
||||
|
||||
if(!_tcscmp(Options[i], Option))
|
||||
return TRUE;
|
||||
}
|
||||
@@ -465,7 +465,7 @@ main (int argc, char * argv [])
|
||||
AddExtension (_T("c\0\0"), _T("Ansi C Source files"));
|
||||
AddExtension (_T("cpp\0cxx\0\0"), _T("C++ Source files"));
|
||||
AddExtension (_T("h\0\0"), _T("Header files"));
|
||||
|
||||
|
||||
for(a = 1; a < argc - 1; a++)
|
||||
{
|
||||
#if UNICODE
|
||||
@@ -479,10 +479,10 @@ main (int argc, char * argv [])
|
||||
Options[a - 1] = argv[a];
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
SkipEmptyLines = IsOptionSet(_T("-e"));
|
||||
BeSilent = IsOptionSet(_T("-s"));
|
||||
|
||||
|
||||
#if UNICODE
|
||||
ZeroMemory(Path, sizeof(Path));
|
||||
if(MultiByteToWideChar(CP_ACP, 0, argv[argc - 1], -1, Path, MAX_PATH) > 0)
|
||||
|
||||
@@ -30,7 +30,7 @@ uint64_ ticks_per_slice[] =
|
||||
{
|
||||
TICKS_YEAR,
|
||||
TICKS_MONTH,
|
||||
TICKS_WEEK,
|
||||
TICKS_WEEK,
|
||||
TICKS_DAY,
|
||||
TICKS_HOUR,
|
||||
TICKS_MINUTE,
|
||||
@@ -103,7 +103,7 @@ void print_uptime
|
||||
_T("and"),
|
||||
(unsigned)tick_cur,
|
||||
(tick_cur == 1 ? slice_names_singular : slice_names_plural)[curslice]
|
||||
);
|
||||
);
|
||||
}
|
||||
}
|
||||
else if(tick_cur != 0)
|
||||
@@ -139,9 +139,9 @@ void print_uptime
|
||||
int parse_print(const _TCHAR * str)
|
||||
{
|
||||
int64_ tickcount;
|
||||
|
||||
|
||||
tickcount = _ttoi64(str);
|
||||
|
||||
|
||||
if(tickcount < 0)
|
||||
tickcount = - tickcount;
|
||||
else if(tickcount == 0)
|
||||
|
||||
@@ -138,7 +138,7 @@ guiStep (va_list ap)
|
||||
{
|
||||
const int pgID = IDC_ST0 + progressGroup * 2;
|
||||
char *str = vstrmake (NULL, ap);
|
||||
|
||||
|
||||
progressCurr++;
|
||||
SetDlgItemText (dialog, pgID, str);
|
||||
SendDlgItemMessage (dialog, pgID+1, PBM_SETPOS,
|
||||
@@ -462,7 +462,7 @@ report (enum report_type t, ...)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
va_start (ap, t);
|
||||
if (t < sizeof text_funcs / sizeof text_funcs[0] &&
|
||||
t < sizeof GUI_funcs / sizeof GUI_funcs[0] &&
|
||||
|
||||
@@ -175,7 +175,7 @@ const char* get_test_source_file(const char* test, const char* subtest)
|
||||
const char* get_file_rev(const char* file)
|
||||
{
|
||||
const struct rev_info* rev;
|
||||
|
||||
|
||||
for(rev = rev_infos; rev->file; rev++) {
|
||||
if (strcmp(rev->file, file) == 0) return rev->rev;
|
||||
}
|
||||
@@ -198,7 +198,7 @@ void extract_rev_infos ()
|
||||
|
||||
len = LoadStringA (module, REV_INFO+i, revinfo, sizeof(revinfo));
|
||||
if (len == 0) break; /* end of revision info */
|
||||
if (len >= sizeof(revinfo) - 1)
|
||||
if (len >= sizeof(revinfo) - 1)
|
||||
report (R_FATAL, "Revision info too long.");
|
||||
if(!(p = strrchr(revinfo, ':')))
|
||||
report (R_FATAL, "Revision info malformed (i=%d)", i);
|
||||
@@ -213,7 +213,7 @@ void* extract_rcdata (int id, int type, DWORD* size)
|
||||
HRSRC rsrc;
|
||||
HGLOBAL hdl;
|
||||
LPVOID addr;
|
||||
|
||||
|
||||
if (!(rsrc = FindResource (NULL, (LPTSTR)id, MAKEINTRESOURCE(type))) ||
|
||||
!(*size = SizeofResource (0, rsrc)) ||
|
||||
!(hdl = LoadResource (0, rsrc)) ||
|
||||
@@ -601,7 +601,7 @@ int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInst,
|
||||
}
|
||||
if (!submit) {
|
||||
if (reset_env && (putenv ("WINETEST_PLATFORM=windows") ||
|
||||
putenv ("WINETEST_DEBUG=1") ||
|
||||
putenv ("WINETEST_DEBUG=1") ||
|
||||
putenv ("WINETEST_INTERACTIVE=0") ||
|
||||
putenv ("WINETEST_REPORT_SUCCESS=0")))
|
||||
report (R_FATAL, "Could not reset environment: %d", errno);
|
||||
|
||||
@@ -73,7 +73,7 @@ SectorsPerTrack dw 18
|
||||
NumberOfHeads dw 2
|
||||
HiddenSectors dd 0
|
||||
TotalSectorsBig dd 0
|
||||
BootDrive db 0
|
||||
BootDrive db 0xff
|
||||
Reserved db 0
|
||||
ExtendSig db 29h
|
||||
SerialNumber dd 00000000h
|
||||
@@ -89,6 +89,9 @@ 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
|
||||
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ int APIENTRY WinMain(HINSTANCE hInstance,
|
||||
MyRegisterClass(hInstance);
|
||||
|
||||
// Perform application initialization:
|
||||
if (!InitInstance (hInstance, nCmdShow))
|
||||
if (!InitInstance (hInstance, nCmdShow))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
@@ -65,9 +65,9 @@ int APIENTRY WinMain(HINSTANCE hInstance,
|
||||
hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_FDEBUG);
|
||||
|
||||
// Main message loop:
|
||||
while (GetMessage(&msg, NULL, 0, 0))
|
||||
while (GetMessage(&msg, NULL, 0, 0))
|
||||
{
|
||||
if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
|
||||
if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
@@ -96,7 +96,7 @@ ATOM MyRegisterClass(HINSTANCE hInstance)
|
||||
{
|
||||
WNDCLASSEX wcex;
|
||||
|
||||
wcex.cbSize = sizeof(WNDCLASSEX);
|
||||
wcex.cbSize = sizeof(WNDCLASSEX);
|
||||
|
||||
wcex.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wcex.lpfnWndProc = (WNDPROC)WndProc;
|
||||
@@ -156,7 +156,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
NONCLIENTMETRICS ncm;
|
||||
HFONT hFont;
|
||||
|
||||
switch (message)
|
||||
switch (message)
|
||||
{
|
||||
case WM_CREATE:
|
||||
|
||||
@@ -174,7 +174,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
break;
|
||||
case WM_COMMAND:
|
||||
wmId = LOWORD(wParam);
|
||||
wmId = LOWORD(wParam);
|
||||
wmEvent = HIWORD(wParam);
|
||||
|
||||
if (lParam == (LPARAM)hEditWnd && wmEvent == EN_CHANGE)
|
||||
@@ -312,7 +312,7 @@ LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
return TRUE;
|
||||
|
||||
case WM_COMMAND:
|
||||
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
|
||||
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
|
||||
{
|
||||
EndDialog(hDlg, LOWORD(wParam));
|
||||
return TRUE;
|
||||
@@ -340,7 +340,7 @@ LRESULT CALLBACK ConnectionDialogProc(HWND hDlg, UINT message, WPARAM wParam, LP
|
||||
GetWindowText(GetDlgItem(hDlg, IDC_BAUTRATE), strBaudRate, MAX_PATH);
|
||||
}
|
||||
|
||||
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
|
||||
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
|
||||
{
|
||||
EndDialog(hDlg, LOWORD(wParam));
|
||||
return TRUE;
|
||||
@@ -392,7 +392,7 @@ LRESULT CALLBACK CaptureDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARA
|
||||
GetWindowText(GetDlgItem(hDlg, IDC_CAPTUREFILENAME), strCaptureFileName, MAX_PATH);
|
||||
}
|
||||
|
||||
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
|
||||
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
|
||||
{
|
||||
EndDialog(hDlg, LOWORD(wParam));
|
||||
return TRUE;
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#define IDC_STATIC -1
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 132
|
||||
|
||||
@@ -83,16 +83,16 @@ BOOL Rs232ClosePortWin32(VOID)
|
||||
// [in] Pointer to a null-terminated string that specifies device-control information.
|
||||
// The string must have the same form as the mode command's command-line arguments.
|
||||
//
|
||||
// For example, the following string specifies a baud rate of 1200, no parity, 8 data bits, and 1 stop bit:
|
||||
// For example, the following string specifies a baud rate of 1200, no parity, 8 data bits, and 1 stop bit:
|
||||
// "baud=1200 parity=N data=8 stop=1"
|
||||
//
|
||||
// The following string specifies a baud rate of 115200, no parity, 8 data bits, and 1 stop bit:
|
||||
// "115200,n,8,1"
|
||||
//
|
||||
// The device name is ignored if it is included in the string, but it must specify a valid device, as follows:
|
||||
// The device name is ignored if it is included in the string, but it must specify a valid device, as follows:
|
||||
// "COM1: baud=1200 parity=N data=8 stop=1"
|
||||
//
|
||||
// For further information on mode command syntax, refer to the end-user documentation for your operating system.
|
||||
// For further information on mode command syntax, refer to the end-user documentation for your operating system.
|
||||
BOOL Rs232ConfigurePortWin32(TCHAR* DeviceControlString)
|
||||
{
|
||||
DCB dcb;
|
||||
@@ -157,28 +157,28 @@ BOOL Rs232ConfigurePortWin32(TCHAR* DeviceControlString)
|
||||
}
|
||||
|
||||
// Members
|
||||
// ReadIntervalTimeout
|
||||
// Specifies the maximum time, in milliseconds, allowed to elapse between the arrival of two characters on the communications line. During a ReadFile operation, the time period begins when the first character is received. If the interval between the arrival of any two characters exceeds this amount, the ReadFile operation is completed and any buffered data is returned. A value of zero indicates that interval time-outs are not used.
|
||||
// A value of MAXDWORD, combined with zero values for both the ReadTotalTimeoutConstant and ReadTotalTimeoutMultiplier members, specifies that the read operation is to return immediately with the characters that have already been received, even if no characters have been received.
|
||||
//
|
||||
// ReadTotalTimeoutMultiplier
|
||||
// Specifies the multiplier, in milliseconds, used to calculate the total time-out period for read operations. For each read operation, this value is multiplied by the requested number of bytes to be read.
|
||||
// ReadTotalTimeoutConstant
|
||||
// Specifies the constant, in milliseconds, used to calculate the total time-out period for read operations. For each read operation, this value is added to the product of the ReadTotalTimeoutMultiplier member and the requested number of bytes.
|
||||
// A value of zero for both the ReadTotalTimeoutMultiplier and ReadTotalTimeoutConstant members indicates that total time-outs are not used for read operations.
|
||||
//
|
||||
// WriteTotalTimeoutMultiplier
|
||||
// Specifies the multiplier, in milliseconds, used to calculate the total time-out period for write operations. For each write operation, this value is multiplied by the number of bytes to be written.
|
||||
// WriteTotalTimeoutConstant
|
||||
// Specifies the constant, in milliseconds, used to calculate the total time-out period for write operations. For each write operation, this value is added to the product of the WriteTotalTimeoutMultiplier member and the number of bytes to be written.
|
||||
// A value of zero for both the WriteTotalTimeoutMultiplier and WriteTotalTimeoutConstant members indicates that total time-outs are not used for write operations.
|
||||
//
|
||||
// ReadIntervalTimeout
|
||||
// Specifies the maximum time, in milliseconds, allowed to elapse between the arrival of two characters on the communications line. During a ReadFile operation, the time period begins when the first character is received. If the interval between the arrival of any two characters exceeds this amount, the ReadFile operation is completed and any buffered data is returned. A value of zero indicates that interval time-outs are not used.
|
||||
// A value of MAXDWORD, combined with zero values for both the ReadTotalTimeoutConstant and ReadTotalTimeoutMultiplier members, specifies that the read operation is to return immediately with the characters that have already been received, even if no characters have been received.
|
||||
//
|
||||
// ReadTotalTimeoutMultiplier
|
||||
// Specifies the multiplier, in milliseconds, used to calculate the total time-out period for read operations. For each read operation, this value is multiplied by the requested number of bytes to be read.
|
||||
// ReadTotalTimeoutConstant
|
||||
// Specifies the constant, in milliseconds, used to calculate the total time-out period for read operations. For each read operation, this value is added to the product of the ReadTotalTimeoutMultiplier member and the requested number of bytes.
|
||||
// A value of zero for both the ReadTotalTimeoutMultiplier and ReadTotalTimeoutConstant members indicates that total time-outs are not used for read operations.
|
||||
//
|
||||
// WriteTotalTimeoutMultiplier
|
||||
// Specifies the multiplier, in milliseconds, used to calculate the total time-out period for write operations. For each write operation, this value is multiplied by the number of bytes to be written.
|
||||
// WriteTotalTimeoutConstant
|
||||
// Specifies the constant, in milliseconds, used to calculate the total time-out period for write operations. For each write operation, this value is added to the product of the WriteTotalTimeoutMultiplier member and the number of bytes to be written.
|
||||
// A value of zero for both the WriteTotalTimeoutMultiplier and WriteTotalTimeoutConstant members indicates that total time-outs are not used for write operations.
|
||||
//
|
||||
// Remarks
|
||||
// If an application sets ReadIntervalTimeout and ReadTotalTimeoutMultiplier to MAXDWORD and sets ReadTotalTimeoutConstant to a value greater than zero and less than MAXDWORD, one of the following occurs when the ReadFile function is called:
|
||||
//
|
||||
// If there are any characters in the input buffer, ReadFile returns immediately with the characters in the buffer.
|
||||
// If there are no characters in the input buffer, ReadFile waits until a character arrives and then returns immediately.
|
||||
// If no character arrives within the time specified by ReadTotalTimeoutConstant, ReadFile times out.
|
||||
// If an application sets ReadIntervalTimeout and ReadTotalTimeoutMultiplier to MAXDWORD and sets ReadTotalTimeoutConstant to a value greater than zero and less than MAXDWORD, one of the following occurs when the ReadFile function is called:
|
||||
//
|
||||
// If there are any characters in the input buffer, ReadFile returns immediately with the characters in the buffer.
|
||||
// If there are no characters in the input buffer, ReadFile waits until a character arrives and then returns immediately.
|
||||
// If no character arrives within the time specified by ReadTotalTimeoutConstant, ReadFile times out.
|
||||
BOOL Rs232SetCommunicationTimeoutsWin32(DWORD ReadIntervalTimeout, DWORD ReadTotalTimeoutMultiplier, DWORD ReadTotalTimeoutConstant, DWORD WriteTotalTimeoutMultiplier, DWORD WriteTotalTimeoutConstant)
|
||||
{
|
||||
COMMTIMEOUTS ct;
|
||||
|
||||
@@ -197,44 +197,44 @@ HalpCalibrateStallExecution(VOID)
|
||||
WRITE_PORT_UCHAR((PUCHAR)0x43, 0x34); /* binary, mode 2, LSB/MSB, ch 0 */
|
||||
WRITE_PORT_UCHAR((PUCHAR)0x40, LATCH & 0xff); /* LSB */
|
||||
WRITE_PORT_UCHAR((PUCHAR)0x40, LATCH >> 8); /* MSB */
|
||||
|
||||
|
||||
/* Stage 1: Coarse calibration */
|
||||
|
||||
|
||||
WaitFor8254Wraparound();
|
||||
|
||||
|
||||
delay_count = 1;
|
||||
|
||||
|
||||
do {
|
||||
delay_count <<= 1; /* Next delay count to try */
|
||||
|
||||
WaitFor8254Wraparound();
|
||||
|
||||
|
||||
__StallExecutionProcessor(delay_count); /* Do the delay */
|
||||
|
||||
|
||||
CurCount = Read8254Timer();
|
||||
} while (CurCount > LATCH / 2);
|
||||
|
||||
|
||||
delay_count >>= 1; /* Get bottom value for delay */
|
||||
|
||||
|
||||
/* Stage 2: Fine calibration */
|
||||
|
||||
|
||||
calib_bit = delay_count; /* Which bit are we going to test */
|
||||
|
||||
|
||||
for(i=0;i<PRECISION;i++) {
|
||||
calib_bit >>= 1; /* Next bit to calibrate */
|
||||
if(!calib_bit) break; /* If we have done all bits, stop */
|
||||
|
||||
|
||||
delay_count |= calib_bit; /* Set the bit in delay_count */
|
||||
|
||||
|
||||
WaitFor8254Wraparound();
|
||||
|
||||
|
||||
__StallExecutionProcessor(delay_count); /* Do the delay */
|
||||
|
||||
|
||||
CurCount = Read8254Timer();
|
||||
if (CurCount <= LATCH / 2) /* If a tick has passed, turn the */
|
||||
delay_count &= ~calib_bit; /* calibrated bit back off */
|
||||
}
|
||||
|
||||
|
||||
/* We're finished: Do the finishing touches */
|
||||
delay_count /= (MILLISEC / 2); /* Calculate delay_count for 1ms */
|
||||
}
|
||||
|
||||
@@ -464,7 +464,7 @@ GetMpConfigurationTable(PMP_FLOATING_POINT_TABLE FpTable)
|
||||
if (ConfigTable->Signature != MP_CT_SIGNATURE)
|
||||
return NULL;
|
||||
|
||||
DbgPrint((DPRINT_HWDETECT,
|
||||
DbgPrint((DPRINT_HWDETECT,
|
||||
"MP Configuration Table at: %x\n",
|
||||
(ULONG)ConfigTable));
|
||||
|
||||
@@ -538,7 +538,7 @@ DetectMps(FRLDRHKEY CpuKey,
|
||||
CpuEntry = (PMP_PROCESSOR_ENTRY)Ptr;
|
||||
|
||||
DbgPrint((DPRINT_HWDETECT, "Processor Entry\n"));
|
||||
DbgPrint((DPRINT_HWDETECT,
|
||||
DbgPrint((DPRINT_HWDETECT,
|
||||
"APIC Id %u APIC Version %u Flags %x Signature %x Feature %x\n",
|
||||
CpuEntry->LocalApicId,
|
||||
CpuEntry->LocalApicVersion,
|
||||
|
||||
@@ -168,7 +168,7 @@ BOOL DiskGetExtendedDriveParameters(ULONG DriveNumber, PVOID Buffer, USHORT Buff
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL i386DiskGetBootVolume(PULONG DriveNumber, PULONGLONG StartSector, PULONGLONG SectorCount, int *FsType)
|
||||
BOOL i386DiskGetBootVolume(PULONG DriveNumber, PULONGLONG StartSector, PULONGLONG SectorCount, int *FsType)
|
||||
{
|
||||
PARTITION_TABLE_ENTRY PartitionTableEntry;
|
||||
UCHAR VolumeType;
|
||||
|
||||
@@ -47,12 +47,12 @@ void delay(unsigned msec)
|
||||
// interrupt from the AT real-time clock chip which is available on INT 70;
|
||||
// because newer BIOSes may have much more precise timers available, it is
|
||||
// not possible to use this function accurately for very short delays unless
|
||||
// the precise behavior of the BIOS is known (or found through testing)
|
||||
// the precise behavior of the BIOS is known (or found through testing)
|
||||
|
||||
while (msec)
|
||||
{
|
||||
msec_this = msec;
|
||||
|
||||
|
||||
if (msec_this > 4000)
|
||||
{
|
||||
msec_this = 4000;
|
||||
|
||||
@@ -88,7 +88,7 @@ typedef struct
|
||||
// A search must then be made to find them, FFFFh will also terminate this
|
||||
// second list. In some cases, only a "stub" VBE may be present, supporting
|
||||
// only AX=4F00h; this case may be assumed if the list of supported video modes
|
||||
// is empty (consisting of a single word of FFFFh)
|
||||
// is empty (consisting of a single word of FFFFh)
|
||||
|
||||
VOID BiosSetVideoFont8x16(VOID)
|
||||
{
|
||||
|
||||
@@ -136,7 +136,7 @@ PcVideoDetectVideoCard(VOID)
|
||||
* CH = feature connector bits
|
||||
* CL = switch settings
|
||||
* AH destroyed (at least by Tseng ET4000 BIOS v8.00n)
|
||||
*
|
||||
*
|
||||
* Installation check;EGA
|
||||
*/
|
||||
Regs.b.ah = 0x12;
|
||||
@@ -161,7 +161,7 @@ PcVideoDetectVideoCard(VOID)
|
||||
* This function is commonly used to check for the presence of a VGA.
|
||||
*
|
||||
* Installation check;VGA
|
||||
*
|
||||
*
|
||||
* Values for display combination code:
|
||||
* 00h no display
|
||||
* 01h monochrome adapter w/ monochrome display
|
||||
@@ -309,15 +309,15 @@ PcVideoDefineCursor(ULONG StartScanLine, ULONG EndScanLine)
|
||||
* CL = bottom scan line containing cursor (bits 0-4)
|
||||
* Return:
|
||||
* Nothing
|
||||
*
|
||||
*
|
||||
* Specify the starting and ending scan lines to be occupied
|
||||
* by the hardware cursor in text modes.
|
||||
*
|
||||
* AMI 386 BIOS and AST Premier 386 BIOS will lock up the
|
||||
* system if AL is not equal to the current video mode.
|
||||
*
|
||||
*
|
||||
* Bitfields for cursor start and options:
|
||||
*
|
||||
*
|
||||
* Bit(s) Description
|
||||
* 7 should be zero
|
||||
* 6,5 cursor blink
|
||||
@@ -460,7 +460,7 @@ PcVideoVesaGetSVGAModeInformation(USHORT Mode, PSVGA_MODE_INFORMATION ModeInform
|
||||
*
|
||||
* Note: While VBE 1.1 and higher will zero out all unused bytes
|
||||
* of the buffer, v1.0 did not, so applications that want to be
|
||||
* backward compatible should clear the buffer before calling
|
||||
* backward compatible should clear the buffer before calling
|
||||
*/
|
||||
Regs.w.ax = 0x4F01;
|
||||
Regs.w.cx = Mode;
|
||||
@@ -563,7 +563,7 @@ PcVideoSetBiosVesaMode(USHORT Mode)
|
||||
* 121h 1600x1200x32K
|
||||
* 122h 1600x1200x64K
|
||||
* 81FFh special full-memory access mode
|
||||
*
|
||||
*
|
||||
* Notes: The special mode 81FFh preserves the contents of the video memory and gives
|
||||
* access to all of the memory; VESA recommends that the special mode be a packed-pixel
|
||||
* mode. For VBE 2.0+, it is required that the VBE implement the mode, but not place it
|
||||
|
||||
@@ -58,8 +58,8 @@ READ_PORT_BUFFER_UCHAR (PUCHAR Port,
|
||||
PUCHAR Buffer,
|
||||
ULONG Count)
|
||||
{
|
||||
__asm__ __volatile__ ("cld ; rep ; insb\n\t"
|
||||
: "=D" (Buffer), "=c" (Count)
|
||||
__asm__ __volatile__ ("cld ; rep ; insb\n\t"
|
||||
: "=D" (Buffer), "=c" (Count)
|
||||
: "d" (Port),"0" (Buffer),"1" (Count));
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ READ_PORT_BUFFER_USHORT (USHORT* Port,
|
||||
ULONG Count)
|
||||
{
|
||||
__asm__ __volatile__ ("cld ; rep ; insw"
|
||||
: "=D" (Buffer), "=c" (Count)
|
||||
: "=D" (Buffer), "=c" (Count)
|
||||
: "d" (Port),"0" (Buffer),"1" (Count));
|
||||
}
|
||||
|
||||
@@ -83,17 +83,17 @@ READ_PORT_BUFFER_ULONG (ULONG* Port,
|
||||
ULONG Count)
|
||||
{
|
||||
__asm__ __volatile__ ("cld ; rep ; insl"
|
||||
: "=D" (Buffer), "=c" (Count)
|
||||
: "=D" (Buffer), "=c" (Count)
|
||||
: "d" (Port),"0" (Buffer),"1" (Count));
|
||||
}
|
||||
|
||||
#undef READ_PORT_UCHAR
|
||||
UCHAR
|
||||
UCHAR
|
||||
STDCALL
|
||||
READ_PORT_UCHAR (PUCHAR Port)
|
||||
{
|
||||
UCHAR Value;
|
||||
|
||||
|
||||
__asm__("inb %w1, %0\n\t"
|
||||
: "=a" (Value)
|
||||
: "d" (Port));
|
||||
@@ -107,7 +107,7 @@ STDCALL
|
||||
READ_PORT_USHORT (USHORT* Port)
|
||||
{
|
||||
USHORT Value;
|
||||
|
||||
|
||||
__asm__("inw %w1, %0\n\t"
|
||||
: "=a" (Value)
|
||||
: "d" (Port));
|
||||
@@ -121,7 +121,7 @@ STDCALL
|
||||
READ_PORT_ULONG (ULONG* Port)
|
||||
{
|
||||
ULONG Value;
|
||||
|
||||
|
||||
__asm__("inl %w1, %0\n\t"
|
||||
: "=a" (Value)
|
||||
: "d" (Port));
|
||||
@@ -130,14 +130,14 @@ READ_PORT_ULONG (ULONG* Port)
|
||||
}
|
||||
|
||||
#undef WRITE_PORT_BUFFER_UCHAR
|
||||
VOID
|
||||
VOID
|
||||
STDCALL
|
||||
WRITE_PORT_BUFFER_UCHAR (PUCHAR Port,
|
||||
PUCHAR Buffer,
|
||||
ULONG Count)
|
||||
{
|
||||
__asm__ __volatile__ ("cld ; rep ; outsb"
|
||||
: "=S" (Buffer), "=c" (Count)
|
||||
__asm__ __volatile__ ("cld ; rep ; outsb"
|
||||
: "=S" (Buffer), "=c" (Count)
|
||||
: "d" (Port),"0" (Buffer),"1" (Count));
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ WRITE_PORT_BUFFER_USHORT (USHORT* Port,
|
||||
ULONG Count)
|
||||
{
|
||||
__asm__ __volatile__ ("cld ; rep ; outsw"
|
||||
: "=S" (Buffer), "=c" (Count)
|
||||
: "=S" (Buffer), "=c" (Count)
|
||||
: "d" (Port),"0" (Buffer),"1" (Count));
|
||||
}
|
||||
|
||||
@@ -160,8 +160,8 @@ WRITE_PORT_BUFFER_ULONG (ULONG* Port,
|
||||
ULONG* Buffer,
|
||||
ULONG Count)
|
||||
{
|
||||
__asm__ __volatile__ ("cld ; rep ; outsl"
|
||||
: "=S" (Buffer), "=c" (Count)
|
||||
__asm__ __volatile__ ("cld ; rep ; outsl"
|
||||
: "=S" (Buffer), "=c" (Count)
|
||||
: "d" (Port),"0" (Buffer),"1" (Count));
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ WRITE_PORT_UCHAR (PUCHAR Port,
|
||||
UCHAR Value)
|
||||
{
|
||||
__asm__("outb %0, %w1\n\t"
|
||||
:
|
||||
:
|
||||
: "a" (Value),
|
||||
"d" (Port));
|
||||
SLOW_DOWN_IO;
|
||||
@@ -185,7 +185,7 @@ WRITE_PORT_USHORT (USHORT* Port,
|
||||
USHORT Value)
|
||||
{
|
||||
__asm__("outw %0, %w1\n\t"
|
||||
:
|
||||
:
|
||||
: "a" (Value),
|
||||
"d" (Port));
|
||||
SLOW_DOWN_IO;
|
||||
@@ -198,7 +198,7 @@ WRITE_PORT_ULONG (ULONG* Port,
|
||||
ULONG Value)
|
||||
{
|
||||
__asm__("outl %0, %w1\n\t"
|
||||
:
|
||||
:
|
||||
: "a" (Value),
|
||||
"d" (Port));
|
||||
SLOW_DOWN_IO;
|
||||
|
||||
@@ -149,7 +149,7 @@ static struct
|
||||
#define IDEWriteDMAStatus(Address, Data) \
|
||||
(WRITE_PORT_UCHAR((PUCHAR)((Address) + 2), (Data)))
|
||||
#define IDEWritePRDTable(Address, Data) \
|
||||
(WRITE_PORT_ULONG((PULONG)((Address) + 4), (Data)))
|
||||
(WRITE_PORT_ULONG((PULONG)((Address) + 4), (Data)))
|
||||
|
||||
/*
|
||||
* Data block read and write commands
|
||||
|
||||
@@ -31,11 +31,11 @@ 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,
|
||||
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),
|
||||
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 ) {
|
||||
@@ -107,7 +107,7 @@ void ofw_print_number( int num ) {
|
||||
|
||||
void PpcPutChar( int ch ) {
|
||||
char buf[3];
|
||||
if( ch == 0x0a ) { buf[0] = 0x0d; buf[1] = 0x0a; }
|
||||
if( ch == 0x0a ) { buf[0] = 0x0d; buf[1] = 0x0a; }
|
||||
else { buf[0] = ch; buf[1] = 0; }
|
||||
buf[2] = 0;
|
||||
ofw_print_string( buf );
|
||||
@@ -167,12 +167,12 @@ BOOL PpcVideoIsPaletteFixed() {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
VOID PpcVideoSetPaletteColor( UCHAR Color,
|
||||
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,
|
||||
VOID PpcVideoGetPaletteColor( UCHAR Color,
|
||||
UCHAR *Red, UCHAR *Green, UCHAR *Blue ) {
|
||||
printf( "GetPaletteColor(%x)\n", Color);
|
||||
}
|
||||
@@ -198,7 +198,7 @@ ULONG PpcGetMemoryMap( PBIOS_MEMORY_MAP BiosMemoryMap,
|
||||
BiosMemoryMap[0].BaseAddress = 0;
|
||||
BiosMemoryMap[0].Length = 32 * 1024 * 1024; /* Assume 32 meg for now */
|
||||
|
||||
printf( "Returning memory map (%dk total)\n",
|
||||
printf( "Returning memory map (%dk total)\n",
|
||||
(int)BiosMemoryMap[0].Length / 1024 );
|
||||
|
||||
return 1;
|
||||
@@ -226,7 +226,7 @@ ULONG PpcDiskGetCacheableBlockCount( ULONG DriveNumber ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
VOID PpcRTCGetCurrentDateTime( PULONG Hear, PULONG Month, PULONG Day,
|
||||
VOID PpcRTCGetCurrentDateTime( PULONG Hear, PULONG Month, PULONG Day,
|
||||
PULONG Hour, PULONG Minute, PULONG Second ) {
|
||||
printf("RTCGeturrentDateTime\n");
|
||||
}
|
||||
@@ -256,7 +256,7 @@ void PpcInit( of_proxy the_ofproxy ) {
|
||||
MachVtbl.VideoSetTextCursorPosition = PpcVideoSetTextCursorPosition;
|
||||
MachVtbl.VideoHideShowTextCursor = PpcVideoHideShowTextCursor;
|
||||
MachVtbl.VideoPutChar = PpcVideoPutChar;
|
||||
MachVtbl.VideoCopyOffScreenBufferToVRAM =
|
||||
MachVtbl.VideoCopyOffScreenBufferToVRAM =
|
||||
PpcVideoCopyOffScreenBufferToVRAM;
|
||||
MachVtbl.VideoIsPaletteFixed = PpcVideoIsPaletteFixed;
|
||||
MachVtbl.VideoSetPaletteColor = PpcVideoSetPaletteColor;
|
||||
@@ -276,13 +276,13 @@ void PpcInit( of_proxy the_ofproxy ) {
|
||||
MachVtbl.HwDetect = PpcHwDetect;
|
||||
|
||||
printf( "FreeLDR version [%s]\n", GetFreeLoaderVersionString() );
|
||||
BootMain("freeldr-ppc");
|
||||
BootMain("freeldr-ppc");
|
||||
}
|
||||
|
||||
void MachInit(char *CmdLine) {
|
||||
int len;
|
||||
printf( "Determining boot device:\n" );
|
||||
len = ofw_getprop(chosen_package, "bootpath",
|
||||
len = ofw_getprop(chosen_package, "bootpath",
|
||||
BootPath, sizeof(BootPath));
|
||||
printf( "Got %d bytes of path\n", len );
|
||||
BootPath[len] = 0;
|
||||
|
||||
+1
-1
@@ -89,7 +89,7 @@ PCACHE_BLOCK CacheInternalFindBlock(PCACHE_DRIVE CacheDrive, ULONG BlockNumber)
|
||||
CacheBlock = (PCACHE_BLOCK)RtlListGetNext((PLIST_ITEM)CacheBlock);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include <freeldr.h>
|
||||
#include <freeldr.h>
|
||||
#include <cmdline.h>
|
||||
#include <rtl.h>
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
|
||||
#include <freeldr.h>
|
||||
#include <rtl.h>
|
||||
#include <ui.h>
|
||||
|
||||
@@ -109,7 +109,7 @@ BOOL DiskGetPartitionEntry(ULONG DriveNumber, ULONG PartitionNumber, PPARTITION_
|
||||
// They want an extended partition entry so we will need
|
||||
// to loop through all the extended partitions on the disk
|
||||
// and return the one they want.
|
||||
|
||||
|
||||
ExtendedPartitionNumber = PartitionNumber - 5;
|
||||
|
||||
// Set the initial relative starting sector to 0
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
|
||||
#include <freeldr.h>
|
||||
#include <drivemap.h>
|
||||
#include <rtl.h>
|
||||
@@ -120,7 +120,7 @@ VOID DriveMapMapDrivesInSection(PCHAR SectionName)
|
||||
BOOL DriveMapIsValidDriveString(PCHAR DriveString)
|
||||
{
|
||||
ULONG Index;
|
||||
|
||||
|
||||
// Now verify that the user has given us appropriate strings
|
||||
if ((strlen(DriveString) < 3) ||
|
||||
((DriveString[0] != 'f') && (DriveString[0] != 'F') && (DriveString[0] != 'h') && (DriveString[0] != 'H')) ||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
|
||||
#include <freeldr.h>
|
||||
#include <rtl.h>
|
||||
#include <arch.h>
|
||||
|
||||
@@ -949,7 +949,7 @@ BOOL Ext2ReadInode(ULONG Inode, PEXT2_INODE InodeBuffer)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
// Copy the data to their buffer
|
||||
RtlCopyMemory(InodeBuffer, (PVOID)(FILESYSBUFFER + (InodeOffsetInBlock * EXT3_INODE_SIZE(Ext2SuperBlock))), sizeof(EXT2_INODE));
|
||||
|
||||
|
||||
@@ -318,8 +318,8 @@ ULONG FatDetermineFatType(PFAT_BOOTSECTOR FatBootSector, ULONG PartitionSectorCo
|
||||
SectorsPerFat = FatBootSector->SectorsPerFat ? FatBootSector->SectorsPerFat : Fat32BootSector->SectorsPerFatBig;
|
||||
TotalSectors = FatBootSector->TotalSectors ? FatBootSector->TotalSectors : FatBootSector->TotalSectorsBig;
|
||||
DataSectorCount = TotalSectors - (FatBootSector->ReservedSectors + (FatBootSector->NumberOfFats * SectorsPerFat) + RootDirSectors);
|
||||
|
||||
//mjl
|
||||
|
||||
//mjl
|
||||
if (FatBootSector->SectorsPerCluster == 0)
|
||||
CountOfClusters = 0;
|
||||
else
|
||||
@@ -861,7 +861,7 @@ BOOL FatGetFatEntry(ULONG Cluster, ULONG* ClusterPointer)
|
||||
}
|
||||
|
||||
fat = *((USHORT *) ((PVOID)FILESYSBUFFER + ThisFatEntOffset));
|
||||
if (Cluster & 0x0001)
|
||||
if (Cluster & 0x0001)
|
||||
fat = fat >> 4; /* Cluster number is ODD */
|
||||
else
|
||||
fat = fat & 0x0FFF; /* Cluster number is EVEN */
|
||||
@@ -870,7 +870,7 @@ BOOL FatGetFatEntry(ULONG Cluster, ULONG* ClusterPointer)
|
||||
|
||||
case FAT16:
|
||||
case FATX16:
|
||||
|
||||
|
||||
FatOffset = (Cluster * 2);
|
||||
ThisFatSecNum = ActiveFatSectorStart + (FatOffset / BytesPerSector);
|
||||
ThisFatEntOffset = (FatOffset % BytesPerSector);
|
||||
@@ -1111,7 +1111,7 @@ BOOL FatReadClusterChain(ULONG StartClusterNumber, ULONG NumberOfClusters, PVOID
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ typedef struct _FAT_BOOTSECTOR
|
||||
UCHAR BootCodeAndData[448]; // The remainder of the boot sector
|
||||
|
||||
USHORT BootSectorMagic; // 0xAA55
|
||||
|
||||
|
||||
} PACKED FAT_BOOTSECTOR, *PFAT_BOOTSECTOR;
|
||||
|
||||
typedef struct _FAT32_BOOTSECTOR
|
||||
@@ -82,7 +82,7 @@ typedef struct _FAT32_BOOTSECTOR
|
||||
UCHAR BootCodeAndData[420]; // The remainder of the boot sector
|
||||
|
||||
USHORT BootSectorMagic; // 0xAA55
|
||||
|
||||
|
||||
} PACKED FAT32_BOOTSECTOR, *PFAT32_BOOTSECTOR;
|
||||
|
||||
typedef struct _FATX_BOOTSECTOR
|
||||
@@ -93,7 +93,7 @@ typedef struct _FATX_BOOTSECTOR
|
||||
USHORT NumberOfFats; /* Number of FAT tables */
|
||||
ULONG Unknown; /* Always 0? */
|
||||
UCHAR Unused[494]; /* Actually size should be 4078 (boot block is 4096 bytes) */
|
||||
|
||||
|
||||
} PACKED FATX_BOOTSECTOR, *PFATX_BOOTSECTOR;
|
||||
|
||||
/*
|
||||
|
||||
@@ -139,7 +139,7 @@ PFILE FsOpenFile(PCHAR FileName)
|
||||
{
|
||||
FileName++;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Check file system type and pass off to appropriate handler
|
||||
//
|
||||
|
||||
@@ -110,7 +110,7 @@ BOOL NtfsFindAttribute(PNTFS_ATTR_CONTEXT Context, PNTFS_MFT_RECORD MftRecord, U
|
||||
{
|
||||
AttrName = (PWCHAR)((PCHAR)AttrRecord + AttrRecord->NameOffset);
|
||||
if (!RtlCompareMemory(AttrName, Name, NameLength << 1))
|
||||
{
|
||||
{
|
||||
/* Found it, fill up the context and return. */
|
||||
Context->Record = AttrRecord;
|
||||
if (AttrRecord->IsNonResident)
|
||||
@@ -125,7 +125,7 @@ BOOL NtfsFindAttribute(PNTFS_ATTR_CONTEXT Context, PNTFS_MFT_RECORD MftRecord, U
|
||||
if (DataRunOffset != -1)
|
||||
{
|
||||
/* Normal run. */
|
||||
Context->CacheRunStartLCN =
|
||||
Context->CacheRunStartLCN =
|
||||
Context->CacheRunLastLCN = DataRunOffset;
|
||||
}
|
||||
else
|
||||
@@ -200,7 +200,7 @@ ULONGLONG NtfsReadAttribute(PNTFS_ATTR_CONTEXT Context, ULONGLONG Offset, PCHAR
|
||||
ULONGLONG CurrentOffset;
|
||||
ULONGLONG ReadLength;
|
||||
ULONGLONG AlreadyRead;
|
||||
|
||||
|
||||
if (!Context->Record->IsNonResident)
|
||||
{
|
||||
if (Offset > Context->Record->Resident.ValueLength)
|
||||
@@ -286,7 +286,7 @@ ULONGLONG NtfsReadAttribute(PNTFS_ATTR_CONTEXT Context, ULONGLONG Offset, PCHAR
|
||||
/*
|
||||
* Go to next run in the list.
|
||||
*/
|
||||
|
||||
|
||||
if (*DataRun == 0)
|
||||
break;
|
||||
DataRun = NtfsDecodeRun(DataRun, &DataRunOffset, &DataRunLength);
|
||||
@@ -341,7 +341,7 @@ BOOL NtfsFixupRecord(PNTFS_RECORD Record)
|
||||
BOOL NtfsReadMftRecord(ULONG MFTIndex, PNTFS_MFT_RECORD Buffer)
|
||||
{
|
||||
ULONGLONG BytesRead;
|
||||
|
||||
|
||||
BytesRead = NtfsReadAttribute(&NtfsMFTContext, MFTIndex * NtfsMftRecordSize, (PCHAR)Buffer, NtfsMftRecordSize);
|
||||
if (BytesRead != NtfsMftRecordSize)
|
||||
return FALSE;
|
||||
@@ -433,7 +433,7 @@ BOOL NtfsFindMftRecord(ULONG MFTIndex, PCHAR FileName, ULONG *OutMFTIndex)
|
||||
MmFreeMemory(MftRecord);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
IndexRecord = MmAllocateMemory(NtfsIndexRecordSize);
|
||||
if (IndexRecord == NULL)
|
||||
{
|
||||
@@ -514,7 +514,7 @@ BOOL NtfsFindMftRecord(ULONG MFTIndex, PCHAR FileName, ULONG *OutMFTIndex)
|
||||
break;
|
||||
RecordOffset += IndexBlockSize;
|
||||
}
|
||||
|
||||
|
||||
if (RecordOffset >= IndexAllocationSize)
|
||||
{
|
||||
break;
|
||||
@@ -533,7 +533,7 @@ BOOL NtfsFindMftRecord(ULONG MFTIndex, PCHAR FileName, ULONG *OutMFTIndex)
|
||||
|
||||
while (IndexEntry < IndexEntryEnd &&
|
||||
!(IndexEntry->Flags & NTFS_INDEX_ENTRY_END))
|
||||
{
|
||||
{
|
||||
if (NtfsCompareFileName(FileName, IndexEntry))
|
||||
{
|
||||
DbgPrint((DPRINT_FILESYSTEM, "File found\n"));
|
||||
@@ -551,7 +551,7 @@ BOOL NtfsFindMftRecord(ULONG MFTIndex, PCHAR FileName, ULONG *OutMFTIndex)
|
||||
|
||||
MmFreeMemory(BitmapData);
|
||||
}
|
||||
|
||||
|
||||
MmFreeMemory(IndexRecord);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
#define NTFS_FILE_NAME_POSIX 0
|
||||
#define NTFS_FILE_NAME_WIN32 1
|
||||
#define NTFS_FILE_NAME_DOS 2
|
||||
#define NTFS_FILE_NAME_WIN32_AND_DOS 3
|
||||
#define NTFS_FILE_NAME_WIN32_AND_DOS 3
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
#define ROUND_UP(N, S) (((N) + (S) - 1) & ~((S) - 1))
|
||||
#define ROUND_DOWN(N, S) ((N) & ~((S) - 1))
|
||||
#define Ke386EraseFlags(x) __asm__ __volatile__("pushl $0 ; popfl\n")
|
||||
|
||||
|
||||
extern BOOL UserInterfaceUp; /* Tells us if the user interface is displayed */
|
||||
|
||||
VOID BootMain(LPSTR CmdLine);
|
||||
|
||||
@@ -102,9 +102,9 @@ typedef struct
|
||||
|
||||
ULONG Code32Start; // here loaders can put a different
|
||||
// start address for 32-bit code.
|
||||
//
|
||||
//
|
||||
// 0x1000 = default for zImage
|
||||
//
|
||||
//
|
||||
// 0x100000 = default for big kernel
|
||||
|
||||
ULONG RamdiskAddress; // address of loaded ramdisk image
|
||||
|
||||
@@ -39,7 +39,7 @@ typedef struct tagMACHVTBL
|
||||
VOID (*ConsPutChar)(int Ch);
|
||||
BOOL (*ConsKbHit)(VOID);
|
||||
int (*ConsGetCh)(VOID);
|
||||
|
||||
|
||||
VOID (*VideoClearScreen)(UCHAR Attr);
|
||||
VIDEODISPLAYMODE (*VideoSetDisplayMode)(char *DisplayMode, BOOL Init);
|
||||
VOID (*VideoGetDisplaySize)(PULONG Width, PULONG Height, PULONG Depth);
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
/* multiboot.h - the header for Multiboot */
|
||||
/* Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
|
||||
|
||||
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. */
|
||||
@@ -157,48 +157,48 @@ ULONG_PTR
|
||||
STDCALL
|
||||
FrLdrCreateModule(LPSTR ModuleName);
|
||||
|
||||
ULONG_PTR
|
||||
STDCALL
|
||||
FrLdrLoadModule(FILE *ModuleImage,
|
||||
LPSTR ModuleName,
|
||||
ULONG_PTR
|
||||
STDCALL
|
||||
FrLdrLoadModule(FILE *ModuleImage,
|
||||
LPSTR ModuleName,
|
||||
PULONG ModuleSize);
|
||||
|
||||
BOOL
|
||||
STDCALL
|
||||
FrLdrLoadKernel(PCHAR szFileName,
|
||||
INT nPos);
|
||||
|
||||
|
||||
BOOL
|
||||
FrLdrLoadNlsFile(PCHAR szSystemRoot,
|
||||
FrLdrLoadNlsFile(PCHAR szSystemRoot,
|
||||
PCHAR szErrorOut);
|
||||
|
||||
|
||||
BOOL
|
||||
FrLdrLoadDriver(PCHAR szFileName,
|
||||
FrLdrLoadDriver(PCHAR szFileName,
|
||||
INT nPos);
|
||||
BOOL
|
||||
LoadSymbolFile(PCHAR szSystemRoot,
|
||||
PCHAR ModuleName,
|
||||
INT nPos);
|
||||
|
||||
|
||||
VOID
|
||||
FrLdrLoadBootDrivers(PCHAR szSystemRoot,
|
||||
FrLdrLoadBootDrivers(PCHAR szSystemRoot,
|
||||
INT nPos);
|
||||
|
||||
|
||||
BOOL
|
||||
STDCALL
|
||||
FrLdrCloseModule(ULONG_PTR ModuleBase,
|
||||
FrLdrCloseModule(ULONG_PTR ModuleBase,
|
||||
ULONG dwModuleSize);
|
||||
|
||||
VOID
|
||||
STDCALL
|
||||
STDCALL
|
||||
FrLdrStartup(ULONG Magic);
|
||||
|
||||
VOID
|
||||
FASTCALL
|
||||
VOID
|
||||
FASTCALL
|
||||
FrLdrGetKernelBase(VOID);
|
||||
|
||||
VOID
|
||||
FASTCALL
|
||||
VOID
|
||||
FASTCALL
|
||||
FrLdrSetupPae(ULONG Magic);
|
||||
|
||||
VOID
|
||||
@@ -206,7 +206,7 @@ FASTCALL
|
||||
FrLdrGetPaeMode(VOID);
|
||||
|
||||
VOID
|
||||
FASTCALL
|
||||
FASTCALL
|
||||
FrLdrSetupPageDirectory(VOID);
|
||||
|
||||
VOID
|
||||
|
||||
@@ -88,7 +88,7 @@ typedef struct _LIST_ITEM
|
||||
{
|
||||
struct _LIST_ITEM* ListPrev;
|
||||
struct _LIST_ITEM* ListNext;
|
||||
|
||||
|
||||
} LIST_ITEM, *PLIST_ITEM;
|
||||
|
||||
VOID RtlListInitializeHead(PLIST_ITEM ListHead); // Initializes a doubly linked list
|
||||
|
||||
@@ -113,7 +113,7 @@ BOOL IniParseFile(PCHAR IniFileData, ULONG IniFileSize)
|
||||
{
|
||||
RtlListInsertTail((PLIST_ITEM)IniFileSectionListHead, (PLIST_ITEM)CurrentSection);
|
||||
}
|
||||
|
||||
|
||||
CurrentLineNumber++;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <freeldr.h>
|
||||
#include <arch.h>
|
||||
#include <disk.h>
|
||||
|
||||
@@ -140,7 +140,7 @@ extern int target_flags;
|
||||
|
||||
/* Compile using ret insn that pops args.
|
||||
This will not work unless you use prototypes at least
|
||||
for all functions that can take varying numbers of args. */
|
||||
for all functions that can take varying numbers of args. */
|
||||
#define TARGET_RTD (target_flags & MASK_RTD)
|
||||
|
||||
/* Align doubles to a two word boundary. This breaks compatibility with
|
||||
@@ -671,7 +671,7 @@ extern int ix86_arch;
|
||||
|
||||
/* Define for XFmode or TFmode extended real floating point support.
|
||||
This will automatically cause REAL_ARITHMETIC to be defined.
|
||||
|
||||
|
||||
The XFmode is specified by i386 ABI, while TFmode may be faster
|
||||
due to alignment and simplifications in the address calculations.
|
||||
*/
|
||||
@@ -767,7 +767,7 @@ extern int ix86_arch;
|
||||
and all fundamental data types supported by the hardware
|
||||
might need to be aligned. No data type wants to be aligned
|
||||
rounder than this.
|
||||
|
||||
|
||||
Pentium+ preferrs DFmode values to be aligned to 64 bit boundary
|
||||
and Pentium Pro XFmode values at 128 bit boundaries. */
|
||||
|
||||
@@ -881,7 +881,7 @@ extern int ix86_arch;
|
||||
/* 1 for registers that have pervasive standard uses
|
||||
and are not available for the register allocator.
|
||||
On the 80386, the stack pointer is such, as is the arg pointer.
|
||||
|
||||
|
||||
The value is an mask - bit 1 is set for fixed registers
|
||||
for 32bit target, while 2 is set for fixed registers for 64bit.
|
||||
Proper value is computed in the CONDITIONAL_REGISTER_USAGE.
|
||||
@@ -899,15 +899,15 @@ extern int ix86_arch;
|
||||
1, 1, 1, 1, 1, 1, 1, 1, \
|
||||
/*xmm8,xmm9,xmm10,xmm11,xmm12,xmm13,xmm14,xmm15*/ \
|
||||
1, 1, 1, 1, 1, 1, 1, 1}
|
||||
|
||||
|
||||
|
||||
/* 1 for registers not available across function calls.
|
||||
These must include the FIXED_REGISTERS and also any
|
||||
registers that can be used without being saved.
|
||||
The latter must include the registers where values are returned
|
||||
and the register where structure-value addresses are passed.
|
||||
Aside from that, you can include as many other registers as you like.
|
||||
|
||||
Aside from that, you can include as many other registers as you like.
|
||||
|
||||
The value is an mask - bit 1 is set for call used
|
||||
for 32bit target, while 2 is set for call used for 64bit.
|
||||
Proper value is computed in the CONDITIONAL_REGISTER_USAGE.
|
||||
@@ -993,7 +993,7 @@ do { \
|
||||
This is ordinarily the length in words of a value of mode MODE
|
||||
but can be less for certain modes in special long registers.
|
||||
|
||||
Actually there are no two word move instructions for consecutive
|
||||
Actually there are no two word move instructions for consecutive
|
||||
registers. And only registers 0-3 may have mov byte instructions
|
||||
applied to them.
|
||||
*/
|
||||
@@ -1100,7 +1100,7 @@ do { \
|
||||
|
||||
#define FIRST_SSE_REG (FRAME_POINTER_REGNUM + 1)
|
||||
#define LAST_SSE_REG (FIRST_SSE_REG + 7)
|
||||
|
||||
|
||||
#define FIRST_MMX_REG (LAST_SSE_REG + 1)
|
||||
#define LAST_MMX_REG (FIRST_MMX_REG + 7)
|
||||
|
||||
@@ -1340,7 +1340,7 @@ enum reg_class
|
||||
|
||||
#define MMX_REGNO_P(N) ((N) >= FIRST_MMX_REG && (N) <= LAST_MMX_REG)
|
||||
#define MMX_REG_P(XOP) (REG_P (XOP) && MMX_REGNO_P (REGNO (XOP)))
|
||||
|
||||
|
||||
#define STACK_REG_P(XOP) \
|
||||
(REG_P (XOP) && \
|
||||
REGNO (XOP) >= FIRST_STACK_REG && \
|
||||
@@ -1471,7 +1471,7 @@ enum reg_class
|
||||
ix86_secondary_memory_needed ((CLASS1), (CLASS2), (MODE), 1)
|
||||
|
||||
/* QImode spills from non-QI registers need a scratch. This does not
|
||||
happen often -- the only example so far requires an uninitialized
|
||||
happen often -- the only example so far requires an uninitialized
|
||||
pseudo. */
|
||||
|
||||
#define SECONDARY_OUTPUT_RELOAD_CLASS(CLASS, MODE, OUT) \
|
||||
@@ -1518,7 +1518,7 @@ enum reg_class
|
||||
|| ((CLASS) == DIREG))
|
||||
|
||||
/* A C statement that adds to CLOBBERS any hard regs the port wishes
|
||||
to automatically clobber for all asms.
|
||||
to automatically clobber for all asms.
|
||||
|
||||
We do this in the new i386 backend to maintain source compatibility
|
||||
with the old cc0-based compiler. */
|
||||
@@ -1556,7 +1556,7 @@ enum reg_class
|
||||
On 386 pushw decrements by exactly 2 no matter what the position was.
|
||||
On the 386 there is no pushb; we use pushw instead, and this
|
||||
has the effect of rounding up to 2.
|
||||
|
||||
|
||||
For 64bit ABI we round up to 8 bytes.
|
||||
*/
|
||||
|
||||
@@ -1777,7 +1777,7 @@ do { \
|
||||
the stack pointer does not matter. The value is tested only in
|
||||
functions that have frame pointers.
|
||||
No definition is equivalent to always zero. */
|
||||
/* Note on the 386 it might be more efficient not to define this since
|
||||
/* Note on the 386 it might be more efficient not to define this since
|
||||
we have to restore it ourselves from the frame pointer, in order to
|
||||
use pop */
|
||||
|
||||
@@ -1999,7 +1999,7 @@ do { \
|
||||
#define REWRITE_ADDRESS(X) rewrite_address (X)
|
||||
|
||||
/* Nonzero if the constant value X is a legitimate general operand
|
||||
when generating PIC code. It is given that flag_pic is on and
|
||||
when generating PIC code. It is given that flag_pic is on and
|
||||
that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
|
||||
|
||||
#define LEGITIMATE_PIC_OPERAND_P(X) \
|
||||
@@ -2191,7 +2191,7 @@ enum ix86_builtins
|
||||
IX86_BUILTIN_RSQRTSS,
|
||||
IX86_BUILTIN_SQRTPS,
|
||||
IX86_BUILTIN_SQRTSS,
|
||||
|
||||
|
||||
IX86_BUILTIN_UNPCKHPS,
|
||||
IX86_BUILTIN_UNPCKLPS,
|
||||
|
||||
@@ -2385,7 +2385,7 @@ do { \
|
||||
precise value of the constant, which is available for examination
|
||||
in X, and the rtx code of the expression in which it is contained,
|
||||
found in OUTER_CODE.
|
||||
|
||||
|
||||
CODE is the expression code--redundant, since it can be obtained
|
||||
with `GET_CODE (X)'. */
|
||||
|
||||
@@ -2709,8 +2709,8 @@ do { \
|
||||
/* Add any extra modes needed to represent the condition code.
|
||||
|
||||
For the i386, we need separate modes when floating-point
|
||||
equality comparisons are being done.
|
||||
|
||||
equality comparisons are being done.
|
||||
|
||||
Add CCNO to indicate comparisons against zero that requires
|
||||
Overflow flag to be unset. Sign bit test is used instead and
|
||||
thus can be used to form "a&b>0" type of tests.
|
||||
@@ -2769,7 +2769,7 @@ do { \
|
||||
For float regs, the stack top is sometimes referred to as "%st(0)"
|
||||
instead of just "%st". PRINT_REG handles this with the "y" code. */
|
||||
|
||||
#undef HI_REGISTER_NAMES
|
||||
#undef HI_REGISTER_NAMES
|
||||
#define HI_REGISTER_NAMES \
|
||||
{"ax","dx","cx","bx","si","di","bp","sp", \
|
||||
"st","st(1)","st(2)","st(3)","st(4)","st(5)","st(6)","st(7)","", \
|
||||
@@ -2819,7 +2819,7 @@ extern int const svr4_dbx_register_map[FIRST_PSEUDO_REGISTER];
|
||||
/* Before the prologue, RA is at 0(%esp). */
|
||||
#define INCOMING_RETURN_ADDR_RTX \
|
||||
gen_rtx_MEM (VOIDmode, gen_rtx_REG (VOIDmode, STACK_POINTER_REGNUM))
|
||||
|
||||
|
||||
/* After the prologue, RA is at -4(AP) in the current frame. */
|
||||
#define RETURN_ADDR_RTX(COUNT, FRAME) \
|
||||
((COUNT) == 0 \
|
||||
@@ -2892,7 +2892,7 @@ extern int const svr4_dbx_register_map[FIRST_PSEUDO_REGISTER];
|
||||
#define JUMP_TABLES_IN_TEXT_SECTION \
|
||||
(!TARGET_64BIT && flag_pic && !HAVE_AS_GOTOFF_IN_DATA)
|
||||
|
||||
/* A C statement that outputs an address constant appropriate to
|
||||
/* A C statement that outputs an address constant appropriate to
|
||||
for DWARF debugging. */
|
||||
|
||||
#define ASM_OUTPUT_DWARF_ADDR_CONST(FILE, X) \
|
||||
@@ -3081,7 +3081,7 @@ extern int const svr4_dbx_register_map[FIRST_PSEUDO_REGISTER];
|
||||
CM_MEDIUM is model assuming that code fits in the first 31bits of address
|
||||
space. Size of data is unlimited.
|
||||
CM_LARGE is model making no assumptions about size of particular sections.
|
||||
|
||||
|
||||
CM_SMALL_PIC is model for PIC libraries assuming that code+data+got/plt
|
||||
tables first in 31bits of address space.
|
||||
*/
|
||||
@@ -3134,12 +3134,12 @@ extern enum reg_class const regclass_map[FIRST_PSEUDO_REGISTER]; /* smalled clas
|
||||
redundant computation of new control word by the mode switching pass.
|
||||
The fldcw instructions are still emitted redundantly, but this is probably
|
||||
not going to be noticeable problem, as most CPUs do have fast path for
|
||||
the sequence.
|
||||
the sequence.
|
||||
|
||||
The machinery is to emit simple truncation instructions and split them
|
||||
before reload to instructions having USEs of two memory locations that
|
||||
are filled by this code to old and new control word.
|
||||
|
||||
|
||||
Post-reload pass may be later used to eliminate the redundant fildcw if
|
||||
needed. */
|
||||
|
||||
|
||||
@@ -140,7 +140,7 @@ extern int target_flags;
|
||||
|
||||
/* Compile using ret insn that pops args.
|
||||
This will not work unless you use prototypes at least
|
||||
for all functions that can take varying numbers of args. */
|
||||
for all functions that can take varying numbers of args. */
|
||||
#define TARGET_RTD (target_flags & MASK_RTD)
|
||||
|
||||
/* Align doubles to a two word boundary. This breaks compatibility with
|
||||
@@ -676,7 +676,7 @@ extern int ix86_arch;
|
||||
|
||||
/* Define for XFmode or TFmode extended real floating point support.
|
||||
This will automatically cause REAL_ARITHMETIC to be defined.
|
||||
|
||||
|
||||
The XFmode is specified by i386 ABI, while TFmode may be faster
|
||||
due to alignment and simplifications in the address calculations.
|
||||
*/
|
||||
@@ -768,7 +768,7 @@ extern int ix86_arch;
|
||||
and all fundamental data types supported by the hardware
|
||||
might need to be aligned. No data type wants to be aligned
|
||||
rounder than this.
|
||||
|
||||
|
||||
Pentium+ preferrs DFmode values to be aligned to 64 bit boundary
|
||||
and Pentium Pro XFmode values at 128 bit boundaries. */
|
||||
|
||||
@@ -882,7 +882,7 @@ extern int ix86_arch;
|
||||
/* 1 for registers that have pervasive standard uses
|
||||
and are not available for the register allocator.
|
||||
On the 80386, the stack pointer is such, as is the arg pointer.
|
||||
|
||||
|
||||
The value is an mask - bit 1 is set for fixed registers
|
||||
for 32bit target, while 2 is set for fixed registers for 64bit.
|
||||
Proper value is computed in the CONDITIONAL_REGISTER_USAGE.
|
||||
@@ -900,15 +900,15 @@ extern int ix86_arch;
|
||||
1, 1, 1, 1, 1, 1, 1, 1, \
|
||||
/*xmm8,xmm9,xmm10,xmm11,xmm12,xmm13,xmm14,xmm15*/ \
|
||||
1, 1, 1, 1, 1, 1, 1, 1}
|
||||
|
||||
|
||||
|
||||
/* 1 for registers not available across function calls.
|
||||
These must include the FIXED_REGISTERS and also any
|
||||
registers that can be used without being saved.
|
||||
The latter must include the registers where values are returned
|
||||
and the register where structure-value addresses are passed.
|
||||
Aside from that, you can include as many other registers as you like.
|
||||
|
||||
Aside from that, you can include as many other registers as you like.
|
||||
|
||||
The value is an mask - bit 1 is set for call used
|
||||
for 32bit target, while 2 is set for call used for 64bit.
|
||||
Proper value is computed in the CONDITIONAL_REGISTER_USAGE.
|
||||
@@ -994,7 +994,7 @@ do { \
|
||||
This is ordinarily the length in words of a value of mode MODE
|
||||
but can be less for certain modes in special long registers.
|
||||
|
||||
Actually there are no two word move instructions for consecutive
|
||||
Actually there are no two word move instructions for consecutive
|
||||
registers. And only registers 0-3 may have mov byte instructions
|
||||
applied to them.
|
||||
*/
|
||||
@@ -1101,7 +1101,7 @@ do { \
|
||||
|
||||
#define FIRST_SSE_REG (FRAME_POINTER_REGNUM + 1)
|
||||
#define LAST_SSE_REG (FIRST_SSE_REG + 7)
|
||||
|
||||
|
||||
#define FIRST_MMX_REG (LAST_SSE_REG + 1)
|
||||
#define LAST_MMX_REG (FIRST_MMX_REG + 7)
|
||||
|
||||
@@ -1341,7 +1341,7 @@ enum reg_class
|
||||
|
||||
#define MMX_REGNO_P(N) ((N) >= FIRST_MMX_REG && (N) <= LAST_MMX_REG)
|
||||
#define MMX_REG_P(XOP) (REG_P (XOP) && MMX_REGNO_P (REGNO (XOP)))
|
||||
|
||||
|
||||
#define STACK_REG_P(XOP) \
|
||||
(REG_P (XOP) && \
|
||||
REGNO (XOP) >= FIRST_STACK_REG && \
|
||||
@@ -1472,7 +1472,7 @@ enum reg_class
|
||||
ix86_secondary_memory_needed ((CLASS1), (CLASS2), (MODE), 1)
|
||||
|
||||
/* QImode spills from non-QI registers need a scratch. This does not
|
||||
happen often -- the only example so far requires an uninitialized
|
||||
happen often -- the only example so far requires an uninitialized
|
||||
pseudo. */
|
||||
|
||||
#define SECONDARY_OUTPUT_RELOAD_CLASS(CLASS, MODE, OUT) \
|
||||
@@ -1519,7 +1519,7 @@ enum reg_class
|
||||
|| ((CLASS) == DIREG))
|
||||
|
||||
/* A C statement that adds to CLOBBERS any hard regs the port wishes
|
||||
to automatically clobber for all asms.
|
||||
to automatically clobber for all asms.
|
||||
|
||||
We do this in the new i386 backend to maintain source compatibility
|
||||
with the old cc0-based compiler. */
|
||||
@@ -1557,7 +1557,7 @@ enum reg_class
|
||||
On 386 pushw decrements by exactly 2 no matter what the position was.
|
||||
On the 386 there is no pushb; we use pushw instead, and this
|
||||
has the effect of rounding up to 2.
|
||||
|
||||
|
||||
For 64bit ABI we round up to 8 bytes.
|
||||
*/
|
||||
|
||||
@@ -1778,7 +1778,7 @@ do { \
|
||||
the stack pointer does not matter. The value is tested only in
|
||||
functions that have frame pointers.
|
||||
No definition is equivalent to always zero. */
|
||||
/* Note on the 386 it might be more efficient not to define this since
|
||||
/* Note on the 386 it might be more efficient not to define this since
|
||||
we have to restore it ourselves from the frame pointer, in order to
|
||||
use pop */
|
||||
|
||||
@@ -2000,7 +2000,7 @@ do { \
|
||||
#define REWRITE_ADDRESS(X) rewrite_address (X)
|
||||
|
||||
/* Nonzero if the constant value X is a legitimate general operand
|
||||
when generating PIC code. It is given that flag_pic is on and
|
||||
when generating PIC code. It is given that flag_pic is on and
|
||||
that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
|
||||
|
||||
#define LEGITIMATE_PIC_OPERAND_P(X) \
|
||||
@@ -2192,7 +2192,7 @@ enum ix86_builtins
|
||||
IX86_BUILTIN_RSQRTSS,
|
||||
IX86_BUILTIN_SQRTPS,
|
||||
IX86_BUILTIN_SQRTSS,
|
||||
|
||||
|
||||
IX86_BUILTIN_UNPCKHPS,
|
||||
IX86_BUILTIN_UNPCKLPS,
|
||||
|
||||
@@ -2386,7 +2386,7 @@ do { \
|
||||
precise value of the constant, which is available for examination
|
||||
in X, and the rtx code of the expression in which it is contained,
|
||||
found in OUTER_CODE.
|
||||
|
||||
|
||||
CODE is the expression code--redundant, since it can be obtained
|
||||
with `GET_CODE (X)'. */
|
||||
|
||||
@@ -2710,8 +2710,8 @@ do { \
|
||||
/* Add any extra modes needed to represent the condition code.
|
||||
|
||||
For the i386, we need separate modes when floating-point
|
||||
equality comparisons are being done.
|
||||
|
||||
equality comparisons are being done.
|
||||
|
||||
Add CCNO to indicate comparisons against zero that requires
|
||||
Overflow flag to be unset. Sign bit test is used instead and
|
||||
thus can be used to form "a&b>0" type of tests.
|
||||
@@ -2770,7 +2770,7 @@ do { \
|
||||
For float regs, the stack top is sometimes referred to as "%st(0)"
|
||||
instead of just "%st". PRINT_REG handles this with the "y" code. */
|
||||
|
||||
#undef HI_REGISTER_NAMES
|
||||
#undef HI_REGISTER_NAMES
|
||||
#define HI_REGISTER_NAMES \
|
||||
{"ax","dx","cx","bx","si","di","bp","sp", \
|
||||
"st","st(1)","st(2)","st(3)","st(4)","st(5)","st(6)","st(7)","", \
|
||||
@@ -2820,7 +2820,7 @@ extern int const svr4_dbx_register_map[FIRST_PSEUDO_REGISTER];
|
||||
/* Before the prologue, RA is at 0(%esp). */
|
||||
#define INCOMING_RETURN_ADDR_RTX \
|
||||
gen_rtx_MEM (VOIDmode, gen_rtx_REG (VOIDmode, STACK_POINTER_REGNUM))
|
||||
|
||||
|
||||
/* After the prologue, RA is at -4(AP) in the current frame. */
|
||||
#define RETURN_ADDR_RTX(COUNT, FRAME) \
|
||||
((COUNT) == 0 \
|
||||
@@ -2893,7 +2893,7 @@ extern int const svr4_dbx_register_map[FIRST_PSEUDO_REGISTER];
|
||||
#define JUMP_TABLES_IN_TEXT_SECTION \
|
||||
(!TARGET_64BIT && flag_pic && !HAVE_AS_GOTOFF_IN_DATA)
|
||||
|
||||
/* A C statement that outputs an address constant appropriate to
|
||||
/* A C statement that outputs an address constant appropriate to
|
||||
for DWARF debugging. */
|
||||
|
||||
#define ASM_OUTPUT_DWARF_ADDR_CONST(FILE, X) \
|
||||
@@ -3082,7 +3082,7 @@ extern int const svr4_dbx_register_map[FIRST_PSEUDO_REGISTER];
|
||||
CM_MEDIUM is model assuming that code fits in the first 31bits of address
|
||||
space. Size of data is unlimited.
|
||||
CM_LARGE is model making no assumptions about size of particular sections.
|
||||
|
||||
|
||||
CM_SMALL_PIC is model for PIC libraries assuming that code+data+got/plt
|
||||
tables first in 31bits of address space.
|
||||
*/
|
||||
@@ -3135,12 +3135,12 @@ extern enum reg_class const regclass_map[FIRST_PSEUDO_REGISTER]; /* smalled clas
|
||||
redundant computation of new control word by the mode switching pass.
|
||||
The fldcw instructions are still emitted redundantly, but this is probably
|
||||
not going to be noticeable problem, as most CPUs do have fast path for
|
||||
the sequence.
|
||||
the sequence.
|
||||
|
||||
The machinery is to emit simple truncation instructions and split them
|
||||
before reload to instructions having USEs of two memory locations that
|
||||
are filled by this code to old and new control word.
|
||||
|
||||
|
||||
Post-reload pass may be later used to eliminate the redundant fildcw if
|
||||
needed. */
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ PUCHAR MmGetSystemMemoryMapTypeString(ULONG Type)
|
||||
return MemoryTypeArray[Index].TypeString;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return MemoryTypeArray[0].TypeString;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -23,15 +23,15 @@
|
||||
#define PDE_SHIFT 20
|
||||
#define PDE_SHIFT_PAE 18
|
||||
|
||||
|
||||
|
||||
/* Converts a Relative Address read from the Kernel into a Physical Address */
|
||||
#define RaToPa(p) \
|
||||
(ULONG_PTR)((ULONG_PTR)p + KERNEL_BASE_PHYS)
|
||||
|
||||
|
||||
/* Converts a Phsyical Address Pointer into a Page Frame Number */
|
||||
#define PaPtrToPfn(p) \
|
||||
(((ULONG_PTR)&p) >> PFN_SHIFT)
|
||||
|
||||
|
||||
/* Converts a Phsyical Address into a Page Frame Number */
|
||||
#define PaToPfn(p) \
|
||||
((p) >> PFN_SHIFT)
|
||||
@@ -40,7 +40,7 @@
|
||||
#define HYPERSPACE_BASE 0xF0800000
|
||||
#define APIC_BASE 0xFEC00000
|
||||
#define KPCR_BASE 0xFF000000
|
||||
|
||||
|
||||
#define LowMemPageTableIndex 0
|
||||
#define StartupPageTableIndex (STARTUP_BASE >> 20) / sizeof(HARDWARE_PTE_X86)
|
||||
#define HyperspacePageTableIndex (HYPERSPACE_BASE >> 20) / sizeof(HARDWARE_PTE_X86)
|
||||
@@ -139,7 +139,7 @@ typedef struct _PAGE_DIRECTORY_TABLE_X64 {
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
/*++
|
||||
* FrLdrStartup
|
||||
* FrLdrStartup
|
||||
* INTERNAL
|
||||
*
|
||||
* Prepares the system for loading the Kernel.
|
||||
@@ -157,25 +157,25 @@ typedef struct _PAGE_DIRECTORY_TABLE_X64 {
|
||||
VOID
|
||||
STDCALL
|
||||
FrLdrStartup(ULONG Magic)
|
||||
{
|
||||
{
|
||||
/* Disable Interrupts */
|
||||
Ke386DisableInterrupts();
|
||||
|
||||
|
||||
/* Re-initalize EFLAGS */
|
||||
Ke386EraseFlags();
|
||||
|
||||
|
||||
/* Get the PAE Mode */
|
||||
FrLdrGetPaeMode();
|
||||
|
||||
|
||||
/* Initialize the page directory */
|
||||
FrLdrSetupPageDirectory();
|
||||
|
||||
|
||||
/* Initialize Paging, Write-Protection and Load NTOSKRNL */
|
||||
FrLdrSetupPae(Magic);
|
||||
}
|
||||
|
||||
/*++
|
||||
* FrLdrSetupPae
|
||||
* FrLdrSetupPae
|
||||
* INTERNAL
|
||||
*
|
||||
* Configures PAE on a MP System, and sets the PDBR if it's supported, or if
|
||||
@@ -201,24 +201,24 @@ FrLdrSetupPae(ULONG Magic)
|
||||
if (PaeModeEnabled)
|
||||
{
|
||||
PageDirectoryBaseAddress = (ULONG_PTR)&startup_pagedirectorytable_pae;
|
||||
|
||||
|
||||
/* Enable PAE */
|
||||
Ke386SetCr4(Ke386GetCr4() | X86_CR4_PAE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Set the PDBR */
|
||||
Ke386SetPageTableDirectory(PageDirectoryBaseAddress);
|
||||
|
||||
|
||||
/* Enable Paging and Write Protect*/
|
||||
Ke386SetCr0(Ke386GetCr0() | X86_CR0_PG | X86_CR0_WP);
|
||||
|
||||
|
||||
/* Jump to Kernel */
|
||||
PagedJump = (ASMCODE)KernelEntryPoint;
|
||||
PagedJump(Magic, &LoaderBlock);
|
||||
}
|
||||
|
||||
/*++
|
||||
* FrLdrGetKernelBase
|
||||
* FrLdrGetKernelBase
|
||||
* INTERNAL
|
||||
*
|
||||
* Gets the Kernel Base to use.
|
||||
@@ -238,17 +238,17 @@ FASTCALL
|
||||
FrLdrGetKernelBase(VOID)
|
||||
{
|
||||
PCHAR p;
|
||||
|
||||
|
||||
/* Read Command Line */
|
||||
p = (PCHAR)LoaderBlock.CommandLine;
|
||||
while ((p = strchr(p, '/')) != NULL) {
|
||||
|
||||
|
||||
/* Find "/3GB" */
|
||||
if (!strnicmp(p + 1, "3GB", 3)) {
|
||||
|
||||
|
||||
/* Make sure there's nothing following it */
|
||||
if (p[4] == ' ' || p[4] == 0) {
|
||||
|
||||
|
||||
/* Use 3GB */
|
||||
KernelBase = 0xC0000000;
|
||||
}
|
||||
@@ -256,13 +256,13 @@ FrLdrGetKernelBase(VOID)
|
||||
|
||||
p++;
|
||||
}
|
||||
|
||||
|
||||
/* Set KernelBase */
|
||||
LoaderBlock.KernelBase = KernelBase;
|
||||
}
|
||||
|
||||
/*++
|
||||
* FrLdrGetPaeMode
|
||||
* FrLdrGetPaeMode
|
||||
* INTERNAL
|
||||
*
|
||||
* Determines whether PAE mode shoudl be enabled or not.
|
||||
@@ -290,7 +290,7 @@ FrLdrGetPaeMode(VOID)
|
||||
}
|
||||
|
||||
/*++
|
||||
* FrLdrSetupPageDirectory
|
||||
* FrLdrSetupPageDirectory
|
||||
* INTERNAL
|
||||
*
|
||||
* Sets up the ReactOS Startup Page Directory.
|
||||
@@ -317,7 +317,7 @@ FrLdrSetupPageDirectory(VOID)
|
||||
ULONG i;
|
||||
|
||||
if (PaeModeEnabled) {
|
||||
|
||||
|
||||
/* Get the Kernel Table Index */
|
||||
KernelPageTableIndex = (KernelBase >> 21);
|
||||
|
||||
@@ -349,7 +349,7 @@ FrLdrSetupPageDirectory(VOID)
|
||||
PageDirPae->Pde[KernelPageTableIndex + i].Write = 1;
|
||||
PageDirPae->Pde[KernelPageTableIndex + i].PageFrameNumber = PaPtrToPfn(kernel_pagetable_pae) + i;
|
||||
}
|
||||
|
||||
|
||||
/* Set up the Startup PDE */
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
@@ -357,7 +357,7 @@ FrLdrSetupPageDirectory(VOID)
|
||||
PageDirPae->Pde[StartupPageTableIndexPae + i].Write = 1;
|
||||
PageDirPae->Pde[StartupPageTableIndexPae + i].PageFrameNumber = PaPtrToPfn(startup_pagedirectory_pae) + i;
|
||||
}
|
||||
|
||||
|
||||
/* Set up the Hyperspace PDE */
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
@@ -365,39 +365,39 @@ FrLdrSetupPageDirectory(VOID)
|
||||
PageDirPae->Pde[HyperspacePageTableIndexPae + i].Write = 1;
|
||||
PageDirPae->Pde[HyperspacePageTableIndexPae + i].PageFrameNumber = PaPtrToPfn(hyperspace_pagetable_pae) + i;
|
||||
}
|
||||
|
||||
/* Set up the Apic PDE */
|
||||
|
||||
/* Set up the Apic PDE */
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
PageDirPae->Pde[ApicPageTableIndexPae + i].Valid = 1;
|
||||
PageDirPae->Pde[ApicPageTableIndexPae + i].Write = 1;
|
||||
PageDirPae->Pde[ApicPageTableIndexPae + i].PageFrameNumber = PaPtrToPfn(apic_pagetable_pae) + i;
|
||||
}
|
||||
|
||||
|
||||
/* Set up the KPCR PDE */
|
||||
PageDirPae->Pde[KpcrPageTableIndexPae].Valid = 1;
|
||||
PageDirPae->Pde[KpcrPageTableIndexPae].Write = 1;
|
||||
PageDirPae->Pde[KpcrPageTableIndexPae].PageFrameNumber = PaPtrToPfn(kpcr_pagetable_pae);
|
||||
|
||||
|
||||
/* Set up Low Memory PTEs */
|
||||
PageDirPae = (PPAGE_DIRECTORY_X64)&lowmem_pagetable_pae;
|
||||
for (i=0; i<1024; i++) {
|
||||
|
||||
|
||||
PageDirPae->Pde[i].Valid = 1;
|
||||
PageDirPae->Pde[i].Write = 1;
|
||||
PageDirPae->Pde[i].Owner = 1;
|
||||
PageDirPae->Pde[i].PageFrameNumber = i;
|
||||
}
|
||||
|
||||
|
||||
/* Set up Kernel PTEs */
|
||||
PageDirPae = (PPAGE_DIRECTORY_X64)&kernel_pagetable_pae;
|
||||
for (i=0; i<1536; i++) {
|
||||
|
||||
|
||||
PageDirPae->Pde[i].Valid = 1;
|
||||
PageDirPae->Pde[i].Write = 1;
|
||||
PageDirPae->Pde[i].PageFrameNumber = PaToPfn(KERNEL_BASE_PHYS) + i;
|
||||
}
|
||||
|
||||
|
||||
/* Set up APIC PTEs */
|
||||
PageDirPae = (PPAGE_DIRECTORY_X64)&apic_pagetable_pae;
|
||||
PageDirPae->Pde[0].Valid = 1;
|
||||
@@ -410,26 +410,26 @@ FrLdrSetupPageDirectory(VOID)
|
||||
PageDirPae->Pde[0x200].CacheDisable = 1;
|
||||
PageDirPae->Pde[0x200].WriteThrough = 1;
|
||||
PageDirPae->Pde[0x200].PageFrameNumber = PaToPfn(APIC_BASE + KERNEL_BASE_PHYS);
|
||||
|
||||
|
||||
/* Set up KPCR PTEs */
|
||||
PageDirPae = (PPAGE_DIRECTORY_X64)&kpcr_pagetable_pae;
|
||||
PageDirPae->Pde[0].Valid = 1;
|
||||
PageDirPae->Pde[0].Write = 1;
|
||||
PageDirPae->Pde[0].PageFrameNumber = 1;
|
||||
|
||||
PageDirPae->Pde[0].PageFrameNumber = 1;
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
/* Get the Kernel Table Index */
|
||||
KernelPageTableIndex = (KernelBase >> PDE_SHIFT) / sizeof(HARDWARE_PTE_X86);
|
||||
|
||||
|
||||
/* Get the Startup Page Directory */
|
||||
PageDir = (PPAGE_DIRECTORY_X86)&startup_pagedirectory;
|
||||
|
||||
|
||||
/* Set up the Low Memory PDE */
|
||||
PageDir->Pde[LowMemPageTableIndex].Valid = 1;
|
||||
PageDir->Pde[LowMemPageTableIndex].Write = 1;
|
||||
PageDir->Pde[LowMemPageTableIndex].PageFrameNumber = PaPtrToPfn(lowmem_pagetable);
|
||||
|
||||
|
||||
/* Set up the Kernel PDEs */
|
||||
PageDir->Pde[KernelPageTableIndex].Valid = 1;
|
||||
PageDir->Pde[KernelPageTableIndex].Write = 1;
|
||||
@@ -437,46 +437,46 @@ FrLdrSetupPageDirectory(VOID)
|
||||
PageDir->Pde[KernelPageTableIndex + 1].Valid = 1;
|
||||
PageDir->Pde[KernelPageTableIndex + 1].Write = 1;
|
||||
PageDir->Pde[KernelPageTableIndex + 1].PageFrameNumber = PaPtrToPfn(kernel_pagetable + 4096);
|
||||
|
||||
|
||||
/* Set up the Startup PDE */
|
||||
PageDir->Pde[StartupPageTableIndex].Valid = 1;
|
||||
PageDir->Pde[StartupPageTableIndex].Write = 1;
|
||||
PageDir->Pde[StartupPageTableIndex].PageFrameNumber = PaPtrToPfn(startup_pagedirectory);
|
||||
|
||||
|
||||
/* Set up the Hyperspace PDE */
|
||||
PageDir->Pde[HyperspacePageTableIndex].Valid = 1;
|
||||
PageDir->Pde[HyperspacePageTableIndex].Write = 1;
|
||||
PageDir->Pde[HyperspacePageTableIndex].PageFrameNumber = PaPtrToPfn(hyperspace_pagetable);
|
||||
|
||||
/* Set up the Apic PDE */
|
||||
|
||||
/* Set up the Apic PDE */
|
||||
PageDir->Pde[ApicPageTableIndex].Valid = 1;
|
||||
PageDir->Pde[ApicPageTableIndex].Write = 1;
|
||||
PageDir->Pde[ApicPageTableIndex].PageFrameNumber = PaPtrToPfn(apic_pagetable);
|
||||
|
||||
|
||||
/* Set up the KPCR PDE */
|
||||
PageDir->Pde[KpcrPageTableIndex].Valid = 1;
|
||||
PageDir->Pde[KpcrPageTableIndex].Write = 1;
|
||||
PageDir->Pde[KpcrPageTableIndex].PageFrameNumber = PaPtrToPfn(kpcr_pagetable);
|
||||
|
||||
|
||||
/* Set up Low Memory PTEs */
|
||||
PageDir = (PPAGE_DIRECTORY_X86)&lowmem_pagetable;
|
||||
for (i=0; i<1024; i++) {
|
||||
|
||||
|
||||
PageDir->Pde[i].Valid = 1;
|
||||
PageDir->Pde[i].Write = 1;
|
||||
PageDir->Pde[i].Owner = 1;
|
||||
PageDir->Pde[i].PageFrameNumber = PaToPfn(i * PAGE_SIZE);
|
||||
}
|
||||
|
||||
|
||||
/* Set up Kernel PTEs */
|
||||
PageDir = (PPAGE_DIRECTORY_X86)&kernel_pagetable;
|
||||
for (i=0; i<1536; i++) {
|
||||
|
||||
|
||||
PageDir->Pde[i].Valid = 1;
|
||||
PageDir->Pde[i].Write = 1;
|
||||
PageDir->Pde[i].PageFrameNumber = PaToPfn(KERNEL_BASE_PHYS + i * PAGE_SIZE);
|
||||
}
|
||||
|
||||
|
||||
/* Set up APIC PTEs */
|
||||
PageDir = (PPAGE_DIRECTORY_X86)&apic_pagetable;
|
||||
PageDir->Pde[0].Valid = 1;
|
||||
@@ -489,18 +489,18 @@ FrLdrSetupPageDirectory(VOID)
|
||||
PageDir->Pde[0x200].CacheDisable = 1;
|
||||
PageDir->Pde[0x200].WriteThrough = 1;
|
||||
PageDir->Pde[0x200].PageFrameNumber = PaToPfn(APIC_BASE + KERNEL_BASE_PHYS);
|
||||
|
||||
|
||||
/* Set up KPCR PTEs */
|
||||
PageDir = (PPAGE_DIRECTORY_X86)&kpcr_pagetable;
|
||||
PageDir->Pde[0].Valid = 1;
|
||||
PageDir->Pde[0].Write = 1;
|
||||
PageDir->Pde[0].PageFrameNumber = 1;
|
||||
PageDir->Pde[0].PageFrameNumber = 1;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/*++
|
||||
* FrLdrMapKernel
|
||||
* FrLdrMapKernel
|
||||
* INTERNAL
|
||||
*
|
||||
* Maps the Kernel into memory, does PE Section Mapping, initalizes the
|
||||
@@ -540,10 +540,10 @@ FrLdrMapKernel(FILE *KernelImage)
|
||||
|
||||
/* Allocate 1024 bytes for PE Header */
|
||||
ImageHeader = (PIMAGE_DOS_HEADER)MmAllocateMemory(1024);
|
||||
|
||||
|
||||
/* Make sure it was succesful */
|
||||
if (ImageHeader == NULL) {
|
||||
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -557,17 +557,17 @@ FrLdrMapKernel(FILE *KernelImage)
|
||||
|
||||
/* Now read the MZ header to get the offset to the PE Header */
|
||||
NtHeader = (PIMAGE_NT_HEADERS)((PCHAR)ImageHeader + ImageHeader->e_lfanew);
|
||||
|
||||
|
||||
/* Get Kernel Base */
|
||||
KernelBase = NtHeader->OptionalHeader.ImageBase;
|
||||
KernelBase = NtHeader->OptionalHeader.ImageBase;
|
||||
FrLdrGetKernelBase();
|
||||
|
||||
|
||||
/* Save Entrypoint */
|
||||
KernelEntry = RaToPa(NtHeader->OptionalHeader.AddressOfEntryPoint);
|
||||
|
||||
|
||||
/* Save the Image Size */
|
||||
ImageSize = NtHeader->OptionalHeader.SizeOfImage;
|
||||
|
||||
|
||||
/* Free the Header */
|
||||
MmFreeMemory(ImageHeader);
|
||||
|
||||
@@ -576,75 +576,75 @@ FrLdrMapKernel(FILE *KernelImage)
|
||||
|
||||
/* Load the file image */
|
||||
FsReadFile(KernelImage, ImageSize, NULL, (PVOID)KERNEL_BASE_PHYS);
|
||||
|
||||
|
||||
/* Reload the NT Header */
|
||||
NtHeader = (PIMAGE_NT_HEADERS)((PCHAR)KERNEL_BASE_PHYS + ImageHeader->e_lfanew);
|
||||
|
||||
|
||||
/* Load the first section */
|
||||
Section = IMAGE_FIRST_SECTION(NtHeader);
|
||||
SectionCount = NtHeader->FileHeader.NumberOfSections - 1;
|
||||
|
||||
|
||||
/* Now go to the last section */
|
||||
Section += SectionCount;
|
||||
|
||||
/* Walk each section backwards */
|
||||
|
||||
/* Walk each section backwards */
|
||||
for (i=SectionCount; i >= 0; i--, Section--) {
|
||||
|
||||
/* Get the disk location and the memory location, and the size */
|
||||
|
||||
/* Get the disk location and the memory location, and the size */
|
||||
SourceSection = RaToPa(Section->PointerToRawData);
|
||||
TargetSection = RaToPa(Section->VirtualAddress);
|
||||
SectionSize = Section->SizeOfRawData;
|
||||
|
||||
|
||||
/* If the section is already mapped correctly, go to the next */
|
||||
if (SourceSection == TargetSection) continue;
|
||||
|
||||
|
||||
/* Load it into memory */
|
||||
memmove((PVOID)TargetSection, (PVOID)SourceSection, SectionSize);
|
||||
|
||||
|
||||
/* Check for unitilizated data */
|
||||
if (Section->SizeOfRawData < Section->Misc.VirtualSize) {
|
||||
|
||||
|
||||
/* Zero it out */
|
||||
memset((PVOID)RaToPa(Section->VirtualAddress + Section->SizeOfRawData),
|
||||
memset((PVOID)RaToPa(Section->VirtualAddress + Section->SizeOfRawData),
|
||||
0,
|
||||
Section->Misc.VirtualSize - Section->SizeOfRawData);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Get the Relocation Data Directory */
|
||||
RelocationDDir = &NtHeader->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC];
|
||||
|
||||
|
||||
/* Get the Relocation Section Start and End*/
|
||||
RelocationDir = (PIMAGE_BASE_RELOCATION)(KERNEL_BASE_PHYS + RelocationDDir->VirtualAddress);
|
||||
RelocationEnd = (PIMAGE_BASE_RELOCATION)((ULONG_PTR)RelocationDir + RelocationDDir->Size);
|
||||
|
||||
|
||||
/* Calculate Difference between Real Base and Compiled Base*/
|
||||
Delta = KernelBase - NtHeader->OptionalHeader.ImageBase;;
|
||||
|
||||
Delta = KernelBase - NtHeader->OptionalHeader.ImageBase;
|
||||
|
||||
/* Determine how far we shoudl relocate */
|
||||
MaxAddress = KERNEL_BASE_PHYS + ImageSize;
|
||||
|
||||
|
||||
/* Relocate until we've processed all the blocks */
|
||||
while (RelocationDir < RelocationEnd && RelocationDir->SizeOfBlock > 0) {
|
||||
|
||||
|
||||
/* See how many Relocation Blocks we have */
|
||||
Count = (RelocationDir->SizeOfBlock - sizeof(IMAGE_BASE_RELOCATION)) / sizeof(USHORT);
|
||||
|
||||
|
||||
/* Calculate the Address of this Directory */
|
||||
Address = KERNEL_BASE_PHYS + RelocationDir->VirtualAddress;
|
||||
|
||||
|
||||
/* Calculate the Offset of the Type */
|
||||
TypeOffset = (PUSHORT)(RelocationDir + 1);
|
||||
|
||||
for (i = 0; i < Count; i++) {
|
||||
|
||||
|
||||
ShortPtr = (PUSHORT)(Address + (*TypeOffset & 0xFFF));
|
||||
|
||||
/* Don't relocate after the end of the loaded driver */
|
||||
if ((ULONG_PTR)ShortPtr >= MaxAddress) break;
|
||||
|
||||
switch (*TypeOffset >> 12) {
|
||||
|
||||
|
||||
case IMAGE_REL_BASED_ABSOLUTE:
|
||||
break;
|
||||
|
||||
@@ -661,14 +661,14 @@ FrLdrMapKernel(FILE *KernelImage)
|
||||
*LongPtr += Delta;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
TypeOffset++;
|
||||
}
|
||||
|
||||
|
||||
/* Move to the next Relocation Table */
|
||||
RelocationDir = (PIMAGE_BASE_RELOCATION)((ULONG_PTR)RelocationDir + RelocationDir->SizeOfBlock);
|
||||
}
|
||||
|
||||
|
||||
/* Increase the next Load Base */
|
||||
NextModuleBase = ROUND_UP(KERNEL_BASE_PHYS + ImageSize, PAGE_SIZE);
|
||||
|
||||
@@ -678,8 +678,8 @@ FrLdrMapKernel(FILE *KernelImage)
|
||||
|
||||
ULONG_PTR
|
||||
STDCALL
|
||||
FrLdrLoadModule(FILE *ModuleImage,
|
||||
LPSTR ModuleName,
|
||||
FrLdrLoadModule(FILE *ModuleImage,
|
||||
LPSTR ModuleName,
|
||||
PULONG ModuleSize)
|
||||
{
|
||||
ULONG LocalModuleSize;
|
||||
@@ -689,12 +689,12 @@ FrLdrLoadModule(FILE *ModuleImage,
|
||||
|
||||
/* Get current module data structure and module name string array */
|
||||
ModuleData = &multiboot_modules[LoaderBlock.ModsCount];
|
||||
|
||||
|
||||
/* Get only the Module Name */
|
||||
do {
|
||||
|
||||
|
||||
TempName = strchr(ModuleName, '\\');
|
||||
|
||||
|
||||
if(TempName) {
|
||||
ModuleName = TempName + 1;
|
||||
}
|
||||
@@ -704,11 +704,11 @@ FrLdrLoadModule(FILE *ModuleImage,
|
||||
|
||||
/* Get Module Size */
|
||||
LocalModuleSize = FsGetFileSize(ModuleImage);
|
||||
|
||||
|
||||
/* Fill out Module Data Structure */
|
||||
ModuleData->ModuleStart = NextModuleBase;
|
||||
ModuleData->ModuleEnd = NextModuleBase + LocalModuleSize;
|
||||
|
||||
|
||||
/* Save name */
|
||||
strcpy(NameBuffer, ModuleName);
|
||||
ModuleData->ModuleName = NameBuffer;
|
||||
@@ -742,7 +742,7 @@ FrLdrCreateModule(LPSTR ModuleName)
|
||||
/* Set up the structure */
|
||||
ModuleData->ModuleStart = NextModuleBase;
|
||||
ModuleData->ModuleEnd = -1;
|
||||
|
||||
|
||||
/* Copy the name */
|
||||
strcpy(NameBuffer, ModuleName);
|
||||
ModuleData->ModuleName = NameBuffer;
|
||||
@@ -756,24 +756,24 @@ FrLdrCreateModule(LPSTR ModuleName)
|
||||
|
||||
BOOL
|
||||
STDCALL
|
||||
FrLdrCloseModule(ULONG_PTR ModuleBase,
|
||||
FrLdrCloseModule(ULONG_PTR ModuleBase,
|
||||
ULONG ModuleSize)
|
||||
{
|
||||
PFRLDR_MODULE ModuleData = CurrentModule;
|
||||
|
||||
/* Make sure a module is opened */
|
||||
if (ModuleData) {
|
||||
|
||||
|
||||
/* Make sure this is the right module and that it hasn't been closed */
|
||||
if ((ModuleBase == ModuleData->ModuleStart) && (ModuleData->ModuleEnd == -1)) {
|
||||
|
||||
|
||||
/* Close the Module */
|
||||
ModuleData->ModuleEnd = ModuleData->ModuleStart + ModuleSize;
|
||||
|
||||
/* Set the next Module Base and increase the number of modules */
|
||||
NextModuleBase = ROUND_UP(ModuleData->ModuleEnd, PAGE_SIZE);
|
||||
LoaderBlock.ModsCount++;
|
||||
|
||||
|
||||
/* Close the currently opened module */
|
||||
CurrentModule = NULL;
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
|
||||
#include <freeldr.h>
|
||||
#include <rtl.h>
|
||||
#include <ui.h>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user