- Convert tditest to PSEH instead of a broken MSVC SEH attempt

- Teach man how to use "subroutines"

svn path=/trunk/; revision=42709
This commit is contained in:
Stefan Ginsberg 2009-08-15 16:40:51 +00:00
parent fad9449b5f
commit c163eb9dc9
2 changed files with 68 additions and 72 deletions

View file

@ -10,6 +10,7 @@
* 26-Nov-2003 Vizzini Updated to run properly on Win2ksp4
*/
#include <tditest.h>
#include <pseh/pseh2.h>
#if DBG
@ -544,22 +545,18 @@ NTSTATUS TdiSendDatagram(
return STATUS_INSUFFICIENT_RESOURCES;
}
#ifdef _MSC_VER
try
{
#endif
MmProbeAndLockPages(Mdl, KernelMode, IoModifyAccess);
#ifdef _MSC_VER
}
except(EXCEPTION_EXECUTE_HANDLER)
{
TDI_DbgPrint(MIN_TRACE, ("MmProbeAndLockPages() failed.\n"));
IoFreeMdl(Mdl);
IoFreeIrp(Irp);
ExFreePool(ConnectInfo);
return STATUS_UNSUCCESSFUL;
}
#endif
_SEH2_TRY
{
MmProbeAndLockPages(Mdl, KernelMode, IoModifyAccess);
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
TDI_DbgPrint(MIN_TRACE, ("MmProbeAndLockPages() failed.\n"));
IoFreeMdl(Mdl);
IoFreeIrp(Irp);
ExFreePool(ConnectInfo);
return STATUS_UNSUCCESSFUL;
} _SEH2_END;
TdiBuildSendDatagram(
Irp, /* I/O Request Packet */
@ -675,23 +672,19 @@ NTSTATUS TdiReceiveDatagram(
return STATUS_INSUFFICIENT_RESOURCES;
}
#ifdef _MSC_VER
try
{
#endif
MmProbeAndLockPages(Mdl, KernelMode, IoModifyAccess);
#ifdef _MSC_VER
}
except (EXCEPTION_EXECUTE_HANDLER)
{
TDI_DbgPrint(MIN_TRACE, ("MmProbeAndLockPages() failed.\n"));
IoFreeMdl(Mdl);
IoFreeIrp(Irp);
ExFreePool(MdlBuffer);
ExFreePool(ReceiveInfo);
return STATUS_INSUFFICIENT_RESOURCES;
}
#endif
_SEH2_TRY
{
MmProbeAndLockPages(Mdl, KernelMode, IoModifyAccess);
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
TDI_DbgPrint(MIN_TRACE, ("MmProbeAndLockPages() failed.\n"));
IoFreeMdl(Mdl);
IoFreeIrp(Irp);
ExFreePool(MdlBuffer);
ExFreePool(ReceiveInfo);
return STATUS_INSUFFICIENT_RESOURCES;
} _SEH2_END;
TdiBuildReceiveDatagram(
Irp, /* I/O Request Packet */

View file

@ -119,48 +119,51 @@ AnalyzeArgv(char *argument)
return element;
}
void sh_outp(char *cur_string)
{
int symbol;
putchar('\n');
putchar('\n');
for(symbol=3;putchar(cur_string[symbol]); symbol++);
}
void th_outp(char *cur_string, char *THtag)
{
int symbol;
putchar('\n');
putchar('\n');
putchar('\t');
putchar('\t');
SetCl(ITALIC);
for(symbol=3;putchar(THtag[symbol]); symbol++);
putchar('\n');
SetCl(NORMAL);
}
void text_outp(char *cur_string)
{
char TagFlag=0;
int symbol=0;
if(cur_string[0]=='.')
while(cur_string[symbol]!=' ')
symbol++;
if(symbol) TagFlag=1;
for(;cur_string[symbol]!='\n'; symbol++)
putchar(cur_string[symbol]);
putchar(' ');
}
int
AnalyzeFile()
{
char *cur_string=(char*)malloc(sizeof(char)*MAXLINE);
int symbol=0;
char *THtag=(char*)malloc(sizeof(char)*MAXLINE);
void sh_outp(void)
{
putchar('\n');
putchar('\n');
for(symbol=3;putchar(cur_string[symbol]); symbol++);
}
void th_outp(void)
{
putchar('\n');
putchar('\n');
putchar('\t');
putchar('\t');
SetCl(ITALIC);
for(symbol=3;putchar(THtag[symbol]); symbol++);
putchar('\n');
SetCl(NORMAL);
}
void text_outp(void)
{
char TagFlag=0;
symbol=0;
if(cur_string[0]=='.')
while(cur_string[symbol]!=' ')
symbol++;
if(symbol) TagFlag=1;
for(;cur_string[symbol]!='\n'; symbol++)
putchar(cur_string[symbol]);
putchar(' ');
}
while(fgets(cur_string,MAXLINE,manfile))
@ -169,7 +172,7 @@ AnalyzeFile()
(cur_string[2]=='H')) // .SH tag
{
SetCl(BOLD);
sh_outp();
sh_outp(cur_string);
SetCl(NORMAL);
}
else
@ -177,7 +180,7 @@ AnalyzeFile()
(cur_string[2]==' ')) // .I tag
{
SetCl(ITALIC);
text_outp();
text_outp(cur_string);
SetCl(NORMAL);
}
else
@ -195,7 +198,7 @@ AnalyzeFile()
(cur_string[2]==' ')) // .B tag
{
SetCl(BOLD);
text_outp();
text_outp(cur_string);
SetCl(NORMAL);
}
else
@ -206,8 +209,8 @@ AnalyzeFile()
putchar(' ');
}
else text_outp(); // print plane text
th_outp();
else text_outp(cur_string); // print plane text
th_outp(cur_string, THtag);
/* END of TAGs processing */
return 0;
}