;===============================================================================
;
; Commands and syntax:
;
;	A comment starts with a ';'. All text to the end of the line is ignored.
;	All string values must be enclosed in double quotes "...".
;	HEX numbers must be preceeded with a "$".
;	Commands are not case sensistive.
;	All whitespace is ignored.
;
;	TITLE <"title">
;			Displays a message when the script is loaded/run.
;			Can be placed anywhere within the script.
;	MESSAGE <"message">
;			Displays a message during script execution.
;	DIR <"directory path">
;			Optional directory path to search for files.
;			For compatibility it is advisable not to use specific
;			drive names in the path.
;	FILE <"filename"> [filesize]
;			Filename to patch. Optional filesize specifies the size
;			that the file must match to be accepted.
;	FIND <byte> [<*>]...
;			Performs a search on the current file for the sequence
;			of bytes that match <byte>... up to max 256. Use the
;			keyword * to match any byte. If a match is found then
;			the PATCH file position value is set to the file
;			position at which the found pattern begins.
;	FUNCTION <"funcname">
;			Sets the current patch position to the file position of
;			the given exported function name (case sensitive). It is
;			assumed that the file being patched is a DLL.
;	PATCH [[POS <file_pos>] | [OFFSET <file_offset>]] <orig_byte> <new_byte>...
;			Patches the current file at optional file position/offset.
;			Replaces orig_byte with new_byte. Fails if original byte
;			read from file is not orig_byte.
;	COPY <"orig_file"> <"new_file">
;			Copies "orig_file" to "new_file"
;	DELETE <"filename">
;			Deletes the specified file.
;	INIFILE <"filemame">
;			Specifies an INI file to be used in subsequent INI commands.
;			This filename is relative to the last DIR directory path.
;	INISECTION <"section">
;			Specifies an INI section name for use in subsequent INIWRITE
;			commands
;	INIWRITE <"keyname"> <"value">
;			Writes the given string value to the INI keyname in the
;			previously specfied INI file's section.
;
;===============================================================================

TITLE "Patch for NiceApp 8.02"

DIR "C:\program Files\Nice App"
FILE "Awcomm32.dll" 129024

MESSAGE "Using file Awcomm32.dll..."

COPY "Awcomm32.dll" "Awcomm32.bak"

FIND
$B8 * * * *			;mov eax, 0669E716
$E8 * * * *			;Call 066A4476
$81 $EC $BC $0E $00 $00		;sub esp, 00000EBC
$53				;push ebx
$56				;push esi
$57				;push edi
$E8 * * * *			;call 066A0E0F
$50				;push eax
$8D $8D $2C $F7 $FF $FF		;lea ecx, dword ptr [ebp+FFFFF72C]
$E8 * * * *			;call 06696196
$C7 $45 $FC $00 $00 $00 $00	;mov [ebp-04], 00000000
$8D $8D $38 $F7 $FF $FF		;lea ecx, dword ptr [ebp+FFFFF738]
$E8 * * * *			;call 066A25BE
$C6 $45 $FC $01			;mov [ebp-04], 01
$8D $8D $14 $F7 $FF $FF		;lea ecx, dword ptr [ebp+FFFFF714]
$E8 * * * *			;call 0669E7AC
$C6 $45 $FC $02			;mov [ebp-04], 02
$0F $B7 $05 * * * *		;movzx eax, word ptr [066A9290]
$85 $C0				;test eax, eax
$0F $85 * * * *			;jne 0669DC6C


PATCH
$B8 $6A				; push 01
*   $01
*   $58				; pop eax
*   $C2				; ret 0004
*   $04
$E8 $00

MESSAGE "Patch complete"
