A Windows XP help forum. PCbanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » PCbanter forum » Microsoft Windows 7 » Windows 7 Forum
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

how to get the title into task manger 'window'?



 
 
Thread Tools Rate Thread Display Modes
  #16  
Old September 20th 18, 08:58 PM posted to alt.msdos.batch,alt.windows7.general
Herbert Kleebauer
external usenet poster
 
Posts: 27
Default how to get the title into task manger 'window'?

On 20.09.2018 00:09, pyotr filipivich wrote:

Use the title command within your batch to set the title to
any string you like.


I do.
setting
Title ZZ Home Agent Bat
results in the window title
Administrator: ZZ Home Agent Bat

how do I get "Administrator" to a) go away,
b) be short enough I can see which "window title" on the task bar
is which actual window?


Just looked up the Windows documentation. You can use SetWindowTextA
from User32.dll to change the title.

https://docs.microsoft.com/en-us/win...setwindowtexta

As long as the batch is running, the title is changed. When
the batch has finished, then the title is reset by CMD to the
original text. Here an example:

:::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::

@echo off
certutil -f -decode %~f0 settitle.exenul

settitle.exe ZZ Home Agent Bat
pause

del settitle.exe
goto :eof

-----BEGIN CERTIFICATE-----
TVpgAQEAAAAEAAAA//8AAGABAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAoAAAAA4fug4AtAnNIbgBTM0hTmljZSB0by BtZWV0IHNvbWVi
b2R5IHdobyBpcyBzdGlsbCB1c2luZyBET1MsDQpidXQgdGhpcy Bwcm9ncmFtIHJl
cXVpcmVzIFdpbjMyLg0KJFBFAABMAQEAUHmlNgAAAAAAAAAA4A APAQsBBQwAAgAA
AAAAAAAAAADMEAAAABAAAAAgAAAAAEAAABAAAAACAAAFAAAAAA AAAAUAAAAAAAAA
ACAAAAACAAAAAAAAAwAAAAAAEAAAEAAAAAAQAAAQAAAAAAAAEA AAAAAAAAAAAAAA
GBAAADwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAQAAAYAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALnRleHQAAAACAQAAAB AAAAACAAAAAgAA
AAAAAAAAAAAAAAAAIAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABoEAAAAA AAAJgQAACqEAAA
vhAAAAAAAABgEAAAAAAAAAAAAABUEAAAABAAAIgQAAAAAAAAAA AAAHoQAAAIEAAA
AAAAAAAAAAAAAAAAAAAAAAAAAABVU0VSMzIuZGxsAABoEAAAAA AAAAAAU2V0V2lu
ZG93VGV4dEEAAEtFUk5FTDMyLmRsbAAAmBAAAKoQAAC+EAAAAA AAAAAAR2V0Q29t
bWFuZExpbmVBAAAAR2V0Q29uc29sZVdpbmRvdwAAAABFeGl0UH JvY2VzcwD/FQgQ
QAAx0khAgDgAdBGAOCJ1AvfSCdJ174A4IHXqQFD/FQwQQABQ/xUAEEAAagD/FRAQ
QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAA==
-----END CERTIFICATE-----

:::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::

The source code:

winmain::

jsr.l (GetCommandLine)
; skip program name
eor.l r1,r1 ; not within "" flag
dec.l r0
_20: inc.l r0
cmp.b #0,(r0)
beq.b _10
cmp.b #'"',(r0)
bne.b _30
not.l r1
_30: or.l r1,r1
bne.b _20
cmp.b #' ',(r0)
bne.b _20
inc.l r0

_10: move.l r0,-(sp)
jsr.l (GetConsoleWindow)
move.l r0,-(sp)
jsr.l (SetWindowTextA)
moveq.l #0,-(sp)
jsr.l (ExitProcess) ; exit program
Ads
  #17  
Old September 20th 18, 11:23 PM posted to alt.msdos.batch,alt.windows7.general
Zaidy036[_5_]
external usenet poster
 
Posts: 427
Default how to get the title into task manger 'window'?

On 9/20/2018 12:33 AM, VanguardLH wrote:
Zaidy036 wrote:

On 9/19/2018 5:19 PM, VanguardLH wrote:
Zaidy036 wrote:

I use Nircmd to rename, change size, and change position of CMD windows:

START "" /WAIT ...
^___ Could've set the new window's title right there.

Because you did not use the /b switch (to reuse the current shell), the
program loads in a new shell (which opens a new console window). You
can use the title parameter of the 'start' command to specify the title
for that new window.

The /wait switch means leaving open the console window for the current
shell until the called program/script exits in the other window. You'll
end up with two windows open: for the console shell where you ran
'start' and the one for within which the program/script runs.


Using Nircmd to change CMD window size and position would then require a
separate CMDs so this works fine for me especially since it does NOT
open a second CMD window.


I like Kleebauer's solution best: just use the 'title' command within
the batch file. However, doesn't do anything regarding positioning of
the window.

Nircmd does positioning - there is no native cmd to do it so why not
resize at the same time? Yes, MODE CON: will resize but not position.

--
Zaidy036
  #18  
Old September 21st 18, 04:17 PM posted to alt.msdos.batch,alt.windows7.general
pyotr filipivich
external usenet poster
 
Posts: 752
Default how to get the title into task manger 'window'?

Herbert Kleebauer on Thu, 20 Sep 2018 21:58:37 +0200
typed in alt.windows7.general the following:

The source code:

winmain::

jsr.l (GetCommandLine)
; skip program name
eor.l r1,r1 ; not within "" flag
dec.l r0
_20: inc.l r0
cmp.b #0,(r0)
beq.b _10
cmp.b #'"',(r0)
bne.b _30
not.l r1
_30: or.l r1,r1
bne.b _20
cmp.b #' ',(r0)
bne.b _20
inc.l r0

_10: move.l r0,-(sp)
jsr.l (GetConsoleWindow)
move.l r0,-(sp)
jsr.l (SetWindowTextA)
moveq.l #0,-(sp)
jsr.l (ExitProcess) ; exit program


Hmmm - where/how do I put/use/invoke this?
--
pyotr filipivich
Next month's Panel: Graft - Boon or blessing?
  #19  
Old September 21st 18, 04:17 PM posted to alt.msdos.batch,alt.windows7.general
pyotr filipivich
external usenet poster
 
Posts: 752
Default how to get the title into task manger 'window'?

VanguardLH on Wed, 19 Sep 2018 23:33:19 -0500 typed in
alt.windows7.general the following:
Zaidy036 wrote:

On 9/19/2018 5:19 PM, VanguardLH wrote:
Zaidy036 wrote:

I use Nircmd to rename, change size, and change position of CMD windows:

START "" /WAIT ...
^___ Could've set the new window's title right there.

Because you did not use the /b switch (to reuse the current shell), the
program loads in a new shell (which opens a new console window). You
can use the title parameter of the 'start' command to specify the title
for that new window.

The /wait switch means leaving open the console window for the current
shell until the called program/script exits in the other window. You'll
end up with two windows open: for the console shell where you ran
'start' and the one for within which the program/script runs.


Using Nircmd to change CMD window size and position would then require a
separate CMDs so this works fine for me especially since it does NOT
open a second CMD window.


I like Kleebauer's solution best: just use the 'title' command within
the batch file. However, doesn't do anything regarding positioning of
the window.


I've found that it is possible to reset the parameters of a
batchfile window, while it is open. Click on the title bar, select
properties, select the "layout tab", make your changes (size &
location), close. Next time you run that batchfile, the window will
have those parameters.
There doesn't seem to be a "restore to default" option. I just
wound up having to create a new "Command Prompt" batchfile, and
reading the parameters and setting the first one "back" to undo the
testing.
--
pyotr filipivich
Next month's Panel: Graft - Boon or blessing?
  #20  
Old September 21st 18, 05:10 PM posted to alt.msdos.batch,alt.windows7.general
Paul[_32_]
external usenet poster
 
Posts: 11,873
Default how to get the title into task manger 'window'?

pyotr filipivich wrote:
Herbert Kleebauer on Thu, 20 Sep 2018 21:58:37 +0200
typed in alt.windows7.general the following:
The source code:

winmain::

jsr.l (GetCommandLine)
; skip program name
eor.l r1,r1 ; not within "" flag
dec.l r0
_20: inc.l r0
cmp.b #0,(r0)
beq.b _10
cmp.b #'"',(r0)
bne.b _30
not.l r1
_30: or.l r1,r1
bne.b _20
cmp.b #' ',(r0)
bne.b _20
inc.l r0

_10: move.l r0,-(sp)
jsr.l (GetConsoleWindow)
move.l r0,-(sp)
jsr.l (SetWindowTextA)
moveq.l #0,-(sp)
jsr.l (ExitProcess) ; exit program


Hmmm - where/how do I put/use/invoke this?


That looks like asm country (assembler).

Herbert mentions "SetWindowTextA" and user32.dll,
so you'll at least need to link those in.

https://stackoverflow.com/questions/...n32-executable

HTH,
Paul
  #21  
Old September 21st 18, 08:00 PM posted to alt.msdos.batch,alt.windows7.general
Herbert Kleebauer
external usenet poster
 
Posts: 27
Default how to get the title into task manger 'window'?

On 21.09.2018 17:17, pyotr filipivich wrote:
Herbert Kleebauer on Thu, 20 Sep 2018 21:58:37 +0200
typed in alt.windows7.general the following:


The source code:

winmain::

jsr.l (GetCommandLine)



Hmmm - where/how do I put/use/invoke this?


Just execute the posted batch file. The binary of the
program is generated on the fly from the batch code
(using certutil to decode the base64 data at the end
of the file). Remove the "del settitle.exe" line if
you want to save the exe file.


  #22  
Old September 22nd 18, 02:08 AM posted to alt.msdos.batch,alt.windows7.general
Paul[_32_]
external usenet poster
 
Posts: 11,873
Default how to get the title into task manger 'window'?

Herbert Kleebauer wrote:
On 21.09.2018 17:17, pyotr filipivich wrote:
Herbert Kleebauer on Thu, 20 Sep 2018 21:58:37 +0200
typed in alt.windows7.general the following:


The source code:

winmain::

jsr.l (GetCommandLine)



Hmmm - where/how do I put/use/invoke this?


Just execute the posted batch file. The binary of the
program is generated on the fly from the batch code
(using certutil to decode the base64 data at the end
of the file). Remove the "del settitle.exe" line if
you want to save the exe file.



This is the base64 stuff decoded.

https://i.postimg.cc/9FkYL8cn/hexdump.gif

I used this for base64 to binary.

https://www.base64decode.org/#decodefiles

And this for trying a few opcodes to sync up to what
might be the code portion.

https://defuse.ca/online-x86-assembler.htm#disassembly2

No idea what it does, but that's a start at analysis.

Paul
  #23  
Old September 22nd 18, 07:04 AM posted to alt.msdos.batch,alt.windows7.general
Herbert Kleebauer
external usenet poster
 
Posts: 27
Default how to get the title into task manger 'window'?

On 22.09.2018 03:08, Paul wrote:

This is the base64 stuff decoded.

https://i.postimg.cc/9FkYL8cn/hexdump.gif

I used this for base64 to binary.

https://www.base64decode.org/#decodefiles


No need to use an external decoder, the batch does the
decoding itself. cerutil is part of Windows since XP.

And this for trying a few opcodes to sync up to what

might be the code portion.

https://defuse.ca/online-x86-assembler.htm#disassembly2

No idea what it does, but that's a start at analysis.


I already posted the few lines of source code. Here the
listing from the assembler which explains the meaning
of every byte in the 1024 byte exe:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;
;; settitle.mac: setzt den title des cmd Fensters solange batch ;;
;; läuft ;;
;; usage: settitle text ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;

UseIdatSection=0 ; 0 if no idat section is used
UseUdatSection=0 ; 0 if no udat section is used

;#================================================ ==================#
;# Start of Headers #
;#================================================ ==================#

; +--------------------------------------------+
; | Start of DOS Header |
; +--------------------------------------------+

; DOS .EXE header
00000000: 00000000: 4d 5a dc.b 'MZ' ; Magic number
00000002: 00000002: 0160 dc.w dosfilesize\512 ; Bytes on last page of file (0-512)
00000004: 00000004: 0001 dc.w (dosfilesize-1)/512+1
; Pages in file (Page=512 byte)
00000006: 00000006: 0000 dc.w 0 ; Relocations (nr of entries)
00000008: 00000008: 0004 dc.w doshead_end/16 ; Size of header size in paragraphs (16 byte)
0000000a: 0000000a: 0000 dc.w 0 ; Minimum extra paragraphs needed
0000000c: 0000000c: ffff dc.w $ffff ; Maximum extra paragraphs needed
0000000e: 0000000e: 0000 dc.w 0 ; Initial (relative) SS value (ss=load_adr+nr)
00000010: 00000010: 0160 dc.w dosstack ; Initial SP value
00000012: 00000012: 0000 dc.w 0 ; Checksum
00000014: 00000014: 0000 dc.w dosmain ; Initial IP value
00000016: 00000016: 0000 dc.w 0 ; Initial (relative) CS value (cs=load_adr+nr)
00000018: 00000018: 0040 dc.w reloc ; File address of relocation table
0000001a: 0000001a: 0000 dc.w 0 ; Overlay number
0000001c: 0000001c: 0000 0000 0000
00000022: 00000022: 0000 dc.w 0,0,0,0 ; Reserved words
00000024: 00000024: 0000 dc.w 0 ; OEM identifier (for e_oeminfo)
00000026: 00000026: 0000 dc.w 0 ; OEM information; e_oemid specific
00000028: 00000028: 00000000 00000000
00000030: 00000030: 00000000 00000000
00000038: 00000038: 00000000 dc.l 0,0,0,0,0 ; Reserved words
0000003c: 0000003c: 000000a0 dc.l WinHeader ; File address of new exe header
reloc:
doshead_end:

@=$0
00000040: 00000000: 0e dosmain:move.w s6,-(sp)
00000041: 00000001: 1f move.w (sp)+,s0
00000042: 00000002: ba 000e move.w #_text,r1
00000045: 00000005: b4 09 move.b #$09,m0
00000047: 00000007: cd 21 trap #$21
00000049: 00000009: b8 4c01 move.w #$4c01,r0
0000004c: 0000000c: cd 21 trap #$21
0000004e: 0000000e: 4e 69 63 65 20 74
00000054: 00000014: 6f 20 6d 65 65 74
0000005a: 0000001a: 20 73 6f 6d 65 62
00000060: 00000020: 6f 64 79 20 77 68
00000066: 00000026: 6f 20 69 73 20 73
0000006c: 0000002c: 74 69 6c 6c 20 75
00000072: 00000032: 73 69 6e 67 20 44
00000078: 00000038: 4f 53 2c 0d 0a _text: dc.b 'Nice to meet somebody who is still using DOS,',13,10
0000007d: 0000003d: 62 75 74 20 74 68
00000083: 00000043: 69 73 20 70 72 6f
00000089: 00000049: 67 72 61 6d 20 72
0000008f: 0000004f: 65 71 75 69 72 65
00000095: 00000055: 73 20 57 69 6e 33
0000009b: 0000005b: 32 2e 0d 0a 24 dc.b 'but this program requires Win32.',13,10,'$'
even 16

dosstack=@+256 ; 256 Byte stack
dosfilesize=@+256

; +--------------------------------------------+
; | End of DOS Header |
; +--------------------------------------------+


; +--------------------------------------------+
; | Start of Windows Header |
; +--------------------------------------------+

ImageBase== $00400000
SectionAlignment== 4096
FileAlignment== 512

WinHeader=@@
@=ImageBase

; see WINNT.H for information
000000a0: 00400000: 50 45 00 00 dc.b 'PE',0,0 ; magic word
; _IMAGE_FILE_HEADER:
000000a4: 00400004: 014c dc.w $014c ; Machine ($014c=Intel x86 processor)
000000a6: 00400006: 0001 dc.w NumberOfSections ; NumberOfSections
000000a8: 00400008: 36a57950 dc.l $36a57950 ; TimeDateStamp (seconds since 31.12.69 16:00)
000000ac: 0040000c: 00000000 dc.l 0 ; PointerToSymbolTable
000000b0: 00400010: 00000000 dc.l 0 ; NumberOfSymbols
000000b4: 00400014: 00e0 dc.w SizeOfOptionalHeader ; SizeOfOptionalHeader
000000b6: 00400016: 010f dc.w $010f ; Charcteristics

; 0x0001 Relocation info stripped from file.
; 0x0002 File is executable (i.e. no unresolved externel references).
; 0x0004 Line nunbers stripped from file.
; 0x0008 Local symbols stripped from file.
; 0x0010 Agressively trim working set
; 0x0080 Bytes of machine word are reversed.
; 0x0100 32 bit word machine.
; 0x0200 Debugging info stripped from file in .DBG file
; 0x0400 If Image is on removable media, copy and run from the swap file.
; 0x0800 If Image is on Net, copy and run from the swap file.
; 0x1000 System File.
; 0x2000 File is a DLL.
; 0x4000 File should only be run on a UP machine
; 0x8000 Bytes of machine word are reversed.

@a=@ ; _IMAGE_OPTIONAL_HEADER
000000b8: 00400018: 010b dc.w $010b ; Magic
000000ba: 0040001a: 05 dc.b 5 ; MajorLinkerVersion
000000bb: 0040001b: 0c dc.b 12 ; MinorLinkerVersion
000000bc: 0040001c: 00000200 dc.l SizeOfCode ; SizeOfCode
000000c0: 00400020: 00000000 dc.l SizeOfInitializedData ; SizeOfInitializedData
000000c4: 00400024: 00000000 dc.l SizeOfUninitializedData ; SizeOfUninitializedData
000000c8: 00400028: 000010cc dc.l winmain-ImageBase ; AddressOfEntryPoint
000000cc: 0040002c: 00001000 dc.l BaseOfCode ; BaseOfCode
000000d0: 00400030: 00002000 dc.l BaseOfData ; BaseOfData
000000d4: 00400034: 00400000 dc.l ImageBase ; ImageBase
000000d8: 00400038: 00001000 dc.l SectionAlignment ; SectionAlignment
000000dc: 0040003c: 00000200 dc.l FileAlignment ; FileAlignment
000000e0: 00400040: 0005 dc.w 5 ; MajorOperatingSystemVersion
000000e2: 00400042: 0000 dc.w 0 ; MinorOperatingSystemVersion
000000e4: 00400044: 0000 dc.w 0 ; MajorImageVersion
000000e6: 00400046: 0000 dc.w 0 ; MinorImageVersion
000000e8: 00400048: 0005 dc.w 5 ; MajorSubsystemVersion
000000ea: 0040004a: 0000 dc.w 0 ; MinorSubsystemVersion
000000ec: 0040004c: 00000000 dc.l 0 ; Win32VersionValue
000000f0: 00400050: 00002000 dc.l SizeOfImage ; SizeOfImage
000000f4: 00400054: 00000200 dc.l SizeOfHeaders ; SizeOfHeaders
000000f8: 00400058: 00000000 dc.l 0 ; CheckSum
000000fc: 0040005c: 0003 dc.w 3 ; Subsystem
; 0: Unknown subsystem.
; 1: Image doesn't require a subsystem.
; 2: Image runs in the Windows GUI subsystem.
; 3: Image runs in the Windows character subsystem.
; 5: image runs in the OS/2 character subsystem.
; 7: image run in the Posix character subsystem.
; 8: image run in the 8 subsystem.
000000fe: 0040005e: 0000 dc.w $0000 ; DllCharacteristics
00000100: 00400060: 00100000 dc.l $00100000 ; SizeOfStackReserve
00000104: 00400064: 00001000 dc.l $00001000 ; SizeOfStackCommit
00000108: 00400068: 00100000 dc.l $00100000 ; SizeOfHeapReserve
0000010c: 0040006c: 00001000 dc.l $00001000 ; SizeOfHeapCommit
00000110: 00400070: 00000000 dc.l $00000000 ; LoaderFlags
00000114: 00400074: 00000010 dc.l NumberOfRvaAndSize ; NumberOfRvaAndSize (entries
; in the data dir)

; ..............................................
; : Start of Image Data Directory :
; ..............................................

; virtual address, size
@b=@
00000118: 00400078: 00000000 00000000 dc.l 0,0 ; Export Directory
00000120: 00400080: 00001018 0000003c dc.l imp_start,imp_size ; Import Directory
00000128: 00400088: 00000000 00000000 dc.l 0,0 ; Resource Directory
00000130: 00400090: 00000000 00000000 dc.l 0,0 ; Exception Directory
00000138: 00400098: 00000000 00000000 dc.l 0,0 ; Security Directory
00000140: 004000a0: 00000000 00000000 dc.l 0,0 ; Base Relocation Table
00000148: 004000a8: 00000000 00000000 dc.l 0,0 ; Debug Directory
00000150: 004000b0: 00000000 00000000 dc.l 0,0 ; Description String
00000158: 004000b8: 00000000 00000000 dc.l 0,0 ; Machine Value (MIPS GP)
00000160: 004000c0: 00000000 00000000 dc.l 0,0 ; TLS Directory
00000168: 004000c8: 00000000 00000000 dc.l 0,0 ; Load Configuration Directory
00000170: 004000d0: 00000000 00000000 dc.l 0,0 ; Bound Import Directory in headers
00000178: 004000d8: 00001000 00000018 dc.l iat_start,iat_size ; Import Address Table
00000180: 004000e0: 00000000 00000000 dc.l 0,0 ; 14
00000188: 004000e8: 00000000 00000000 dc.l 0,0 ; 15
00000190: 004000f0: 00000000 00000000 dc.l 0,0 ; 16

NumberOfRvaAndSize = (@-@b)/8
SizeOfOptionalHeader = @-@a

; ..............................................
; : End of Image Data Directory :
; ..............................................

; ..............................................
; : Start of Image Sections Header :
; ..............................................

@a=@

00000198: 004000f8: 2e 74 65 78 74 00
0000019e: 004000fe: 00 00 dc.b '.text',0,0,0 ; name
000001a0: 00400100: 00000102 dc.l VSizeOf_text ; virtual size
000001a4: 00400104: 00001000 dc.l VBaseOf_text ; virtual address
000001a8: 00400108: 00000200 dc.l FSizeOf_text ; size of raw data
000001ac: 0040010c: 00000200 dc.l FBaseOf_text ; pointer to raw data
000001b0: 00400110: 00000000 dc.l 0 ; pointer to relocatins
000001b4: 00400114: 00000000 dc.l 0 ; pointer to line numbers
000001b8: 00400118: 0000 dc.w 0 ; number of relocations
000001ba: 0040011a: 0000 dc.w 0 ; number of line numbers
000001bc: 0040011c: e0000020 dc.l $e0000020 ; characteristics


IF UseIdatSection
dc.b '.idat',0,0,0 ; name
dc.l VSizeOf_idat ; virtual size
dc.l VBaseOf_idat ; virtual address
dc.l FSizeOf_idat ; size of raw data
dc.l FBaseOf_idat ; pointer to raw data
dc.l 0 ; pointer to relocatins
dc.l 0 ; pointer to line numbers
dc.w 0 ; number of relocations
dc.w 0 ; number of line numbers
dc.l $e0000040 ; characteristics
ENDIF

IF UseUdatSection
dc.b '.udat',0,0,0 ; name
dc.l VSizeOf_udat ; virtual size
dc.l VBaseOf_udat ; virtual address
dc.l FSizeOf_udat ; size of raw data
dc.l FBaseOf_udat ; pointer to raw data
dc.l 0 ; pointer to relocatins
dc.l 0 ; pointer to line numbers
dc.w 0 ; number of relocations
dc.w 0 ; number of line numbers
dc.l $e0000080 ; characteristics
ENDIF

NumberOfSections=(@-@a)/40

; ..............................................
; : End of Image Sections Header :
; ..............................................

; characteristics
; 0x00000020 // Section contains code.
; 0x00000040 // Section contains initialized data.
; 0x00000080 // Section contains uninitialized data.
; 0x00000200 // Section contains comments or some other type of information.
; 0x00000800 // Section contents will not become part of image.
; 0x00001000 // Section contents comdat.
; 0x01000000 // Section contains extended relocations.
; 0x02000000 // Section can be discarded.
; 0x04000000 // Section is not cachable.
; 0x08000000 // Section is not pageable.
; 0x10000000 // Section is shareable.
; 0x20000000 // Section is executable.
; 0x40000000 // Section is readable.
; 0x80000000 // Section is writeable.

; +--------------------------------------------+
; | End of Windows Header |
; +--------------------------------------------+

000001c0: 00400120: 00 00 00 00 00 00
000001c6: 00400126: 00 00 00 00 00 00
000001cc: 0040012c: 00 00 00 00 00 00
000001d2: 00400132: 00 00 00 00 00 00
000001d8: 00400138: 00 00 00 00 00 00
000001de: 0040013e: 00 00 00 00 00 00
000001e4: 00400144: 00 00 00 00 00 00
000001ea: 0040014a: 00 00 00 00 00 00
000001f0: 00400150: 00 00 00 00 00 00
000001f6: 00400156: 00 00 00 00 00 00
000001fc: 0040015c: 00 00 00 00 evencom FileAlignment

SizeOfHeaders==@@

;#================================================ ==================#
;# End of Headers #
;#================================================ ==================#

;#================================================ ==================#
;# Start of Sections #
;#================================================ ==================#

; +--------------------------------------------+
; | Start of .text Section |
; +--------------------------------------------+

FBaseOf_text==@@
VBaseOf_text==(@-ImageBase+SectionAlignment-1)/SectionAlignment*SectionAlignment
BaseOfCode==VBaseOf_text
@=ImageBase+VBaseOf_text


; ..............................................
; : Start of Thunk Table :
; ..............................................


iat_start=@-ImageBase

USER32_thunk:
00000200: 00401000: 00001068 SetWindowTextA:: dc.l USER32_SetWindowTextA -ImageBase
00000204: 00401004: 00000000 dc.l 0

KERNEL32_thunk:
00000208: 00401008: 00001098 GetCommandLine:: dc.l KERNEL32_GetCommandLine -Imagebase
0000020c: 0040100c: 000010aa GetConsoleWindow:: dc.l KERNEL32_GetConsoleWindow -Imagebase
00000210: 00401010: 000010be ExitProcess:: dc.l KERNEL32_ExitProcess -ImageBase
00000214: 00401014: 00000000 dc.l 0


iat_size=@-ImageBase-iat_start

; ..............................................
; : End of Thunk Table :
; ..............................................


; ..............................................
; : Start of Import Directory :
; ..............................................


imp_start==@-ImageBase

imp:

00000218: 00401018: 00001060 dc.l USER32_import -ImageBase
0000021c: 0040101c: 00000000 dc.l 0
00000220: 00401020: 00000000 dc.l 0
00000224: 00401024: 00001054 dc.l USER32_name -ImageBase
00000228: 00401028: 00001000 dc.l USER32_thunk -ImageBase

0000022c: 0040102c: 00001088 dc.l KERNEL32_import -ImageBase
00000230: 00401030: 00000000 dc.l 0
00000234: 00401034: 00000000 dc.l 0
00000238: 00401038: 0000107a dc.l KERNEL32_name -ImageBase
0000023c: 0040103c: 00001008 dc.l KERNEL32_thunk -ImageBase

00000240: 00401040: 00000000 dc.l 0
00000244: 00401044: 00000000 dc.l 0
00000248: 00401048: 00000000 dc.l 0
0000024c: 0040104c: 00000000 dc.l 0
00000250: 00401050: 00000000 dc.l 0

imp_size==@-imp

; ..............................................
; : End of Import Directory :
; ..............................................



USER32_name:
00000254: 00401054: 55 53 45 52 33 32
0000025a: 0040105a: 2e 64 6c 6c 00 dc.b 'USER32.dll',0
0000025f: 0040105f: 00 even


USER32_import:
00000260: 00401060: 00001068 dc.l USER32_SetWindowTextA -ImageBase
00000264: 00401064: 00000000 dc.l 0
even

USER32_SetWindowTextA:
00000268: 00401068: 0000 dc.w 0
0000026a: 0040106a: 53 65 74 57 69 6e
00000270: 00401070: 64 6f 77 54 65 78
00000276: 00401076: 74 41 00 dc.b 'SetWindowTextA',0
00000279: 00401079: 00 even


KERNEL32_name:
0000027a: 0040107a: 4b 45 52 4e 45 4c
00000280: 00401080: 33 32 2e 64 6c 6c
00000286: 00401086: 00 dc.b 'KERNEL32.dll',0
00000287: 00401087: 00 even

KERNEL32_import:
00000288: 00401088: 00001098 dc.l KERNEL32_GetCommandLine -ImageBase
0000028c: 0040108c: 000010aa dc.l KERNEL32_GetConsoleWindow -ImageBase
00000290: 00401090: 000010be dc.l KERNEL32_ExitProcess -ImageBase
00000294: 00401094: 00000000 dc.l 0
even

KERNEL32_GetCommandLine:
00000298: 00401098: 0000 dc.w 0
0000029a: 0040109a: 47 65 74 43 6f 6d
000002a0: 004010a0: 6d 61 6e 64 4c 69
000002a6: 004010a6: 6e 65 41 00 dc.b 'GetCommandLineA',0
even

KERNEL32_GetConsoleWindow:
000002aa: 004010aa: 0000 dc.w 0
000002ac: 004010ac: 47 65 74 43 6f 6e
000002b2: 004010b2: 73 6f 6c 65 57 69
000002b8: 004010b8: 6e 64 6f 77 00 dc.b 'GetConsoleWindow',0
000002bd: 004010bd: 00 even

KERNEL32_ExitProcess:
000002be: 004010be: 0000 dc.w 0
000002c0: 004010c0: 45 78 69 74 50 72
000002c6: 004010c6: 6f 63 65 73 73 00 dc.b 'ExitProcess',0
even


; ..............................................
; : Start of Code :
; ..............................................


label_block
seg32


winmain::

000002cc: 004010cc: ff 15 00401008 jsr.l (GetCommandLine)
; skip program name
000002d2: 004010d2: 31 d2 eor.l r1,r1 ; not within "" flag
000002d4: 004010d4: 48 dec.l r0
000002d5: 004010d5: 40 _20: inc.l r0
000002d6: 004010d6: 80 38 00 cmp.b #0,(r0)
000002d9: 004010d9: 74 11 beq.b _10
000002db: 004010db: 80 38 22 cmp.b #'"',(r0)
000002de: 004010de: 75 02 bne.b _30
000002e0: 004010e0: f7 d2 not.l r1
000002e2: 004010e2: 09 d2 _30: or.l r1,r1
000002e4: 004010e4: 75 ef bne.b _20
000002e6: 004010e6: 80 38 20 cmp.b #' ',(r0)
000002e9: 004010e9: 75 ea bne.b _20
000002eb: 004010eb: 40 inc.l r0

000002ec: 004010ec: 50 _10: move.l r0,-(sp)
000002ed: 004010ed: ff 15 0040100c jsr.l (GetConsoleWindow)
000002f3: 004010f3: 50 move.l r0,-(sp)
000002f4: 004010f4: ff 15 00401000 jsr.l (SetWindowTextA)
000002fa: 004010fa: 6a 00 moveq.l #0,-(sp)
000002fc: 004010fc: ff 15 00401010 jsr.l (ExitProcess) ; exit program

; ..............................................
; : End of Code :
; ..............................................

VSizeOf_text==@-Imagebase-VBaseOf_text
@a=@
00000302: 00401102: 00 00 00 00 00 00
00000308: 00401108: 00 00 00 00 00 00
0000030e: 0040110e: 00 00 00 00 00 00
00000314: 00401114: 00 00 00 00 00 00
0000031a: 0040111a: 00 00 00 00 00 00
00000320: 00401120: 00 00 00 00 00 00
00000326: 00401126: 00 00 00 00 00 00
0000032c: 0040112c: 00 00 00 00 00 00
00000332: 00401132: 00 00 00 00 00 00
00000338: 00401138: 00 00 00 00 00 00
0000033e: 0040113e: 00 00 00 00 00 00
00000344: 00401144: 00 00 00 00 00 00
0000034a: 0040114a: 00 00 00 00 00 00
00000350: 00401150: 00 00 00 00 00 00
00000356: 00401156: 00 00 00 00 00 00
0000035c: 0040115c: 00 00 00 00 00 00
00000362: 00401162: 00 00 00 00 00 00
00000368: 00401168: 00 00 00 00 00 00
0000036e: 0040116e: 00 00 00 00 00 00
00000374: 00401174: 00 00 00 00 00 00
0000037a: 0040117a: 00 00 00 00 00 00
00000380: 00401180: 00 00 00 00 00 00
00000386: 00401186: 00 00 00 00 00 00
0000038c: 0040118c: 00 00 00 00 00 00
00000392: 00401192: 00 00 00 00 00 00
00000398: 00401198: 00 00 00 00 00 00
0000039e: 0040119e: 00 00 00 00 00 00
000003a4: 004011a4: 00 00 00 00 00 00
000003aa: 004011aa: 00 00 00 00 00 00
000003b0: 004011b0: 00 00 00 00 00 00
000003b6: 004011b6: 00 00 00 00 00 00
000003bc: 004011bc: 00 00 00 00 00 00
000003c2: 004011c2: 00 00 00 00 00 00
000003c8: 004011c8: 00 00 00 00 00 00
000003ce: 004011ce: 00 00 00 00 00 00
000003d4: 004011d4: 00 00 00 00 00 00
000003da: 004011da: 00 00 00 00 00 00
000003e0: 004011e0: 00 00 00 00 00 00
000003e6: 004011e6: 00 00 00 00 00 00
000003ec: 004011ec: 00 00 00 00 00 00
000003f2: 004011f2: 00 00 00 00 00 00
000003f8: 004011f8: 00 00 00 00 00 00
000003fe: 004011fe: 00 00 evencom FileAlignment
@=@a

FSizeOf_text==@@-FBaseOf_text
SizeOfCode==FSizeOf_text


; +--------------------------------------------+
; | End of .text Section |
; +--------------------------------------------+


; +--------------------------------------------+
; | Start of .idat Section |
; +--------------------------------------------+


FBaseOf_idat==@@
VBaseOf_idat==(@-ImageBase+SectionAlignment-1)/SectionAlignment*SectionAlignment
BaseOfData==VBaseOf_idat
@=ImageBase+VBaseOf_idat

; Insert initialized variables here (and set UseIdatSection=1
; at the top of this file). Because the code section is set
; r/w-able, you can put initialized variables also into the
; code section.

; var1: dc.l 0
; var2: dc.l $12345678

VSizeOf_idat==@-Imagebase-VBaseOf_idat
@a=@
evencom FileAlignment
@=@a
FSizeOf_idat==@@-FBaseOf_idat

; +--------------------------------------------+
; | End of .idat Section |
; +--------------------------------------------+

SizeOfInitializedData==FSizeOf_idat


; +--------------------------------------------+
; | Start of .udat Section |
; +--------------------------------------------+


FBaseOf_udat==@@
VBaseOf_udat==(@-ImageBase+SectionAlignment-1)/SectionAlignment*SectionAlignment
@=ImageBase+VBaseOf_udat

; Insert uninitialized variables here (and set UseUdatSection=1
; at the top of this file). Because the code section is set
; r/w-able, you can put uninitialized variables also at the END
; of the code section.

; buf1: blk.l 10
; buf2: blk.l 200

VSizeOf_udat==@-Imagebase-VBaseOf_udat
@a=@
evencom FileAlignment
@=@a
FSizeOf_udat==@@-FBaseOf_udat

; +--------------------------------------------+
; | End of .udat Section |
; +--------------------------------------------+

SizeOfUninitializedData==VSizeOf_udat
SizeOfImage==(@-ImageBase+SectionAlignment-1)/SectionAlignment*SectionAlignment


;#================================================ ==================#
;# End of Sections #
;#================================================ ==================#



useidatsection. 00000000 useudatsection. 00000000 reloc.......... 00000040
doshead_end.... 00000040 dosmain........ 00000000 dosstack....... 00000160
dosfilesize.... 00000160 imagebase...... 00400000 sectionalignment 00001000
filealignment.. 00000200 winheader...... 000000a0 numberofrvaandsize 00000010
sizeofoptionalheader 000000e0 numberofsections 00000001 sizeofheaders.. 00000200
fbaseof_text... 00000200 vbaseof_text... 00001000 baseofcode..... 00001000
iat_start...... 00001000 user32_thunk... 00401000 setwindowtexta. 00401000
kernel32_thunk. 00401008 getcommandline. 00401008 getconsolewindow 0040100c
exitprocess.... 00401010 iat_size....... 00000018 imp_start...... 00001018
imp............ 00401018 imp_size....... 0000003c user32_name.... 00401054
user32_import.. 00401060 user32_setwindowtexta 00401068 kernel32_name.. 0040107a
kernel32_import 00401088 kernel32_getcommandline 00401098 kernel32_getconsolewindow 004010aa
kernel32_exitprocess 004010be winmain........ 004010cc vsizeof_text... 00000102
fsizeof_text... 00000200 sizeofcode..... 00000200 fbaseof_idat... 00000400
vbaseof_idat... 00002000 baseofdata..... 00002000 vsizeof_idat... 00000000
fsizeof_idat... 00000000 sizeofinitializeddata 00000000 fbaseof_udat... 00000400
vbaseof_udat... 00002000 vsizeof_udat... 00000000 fsizeof_udat... 00000000
sizeofuninitializeddata 00000000 sizeofimage.... 00002000

  #24  
Old September 23rd 18, 01:43 AM posted to alt.msdos.batch,alt.windows7.general
pyotr filipivich
external usenet poster
 
Posts: 752
Default how to get the title into task manger 'window'?

Herbert Kleebauer on Fri, 21 Sep 2018 21:00:39 +0200
typed in alt.windows7.general the following:
On 21.09.2018 17:17, pyotr filipivich wrote:
Herbert Kleebauer on Thu, 20 Sep 2018 21:58:37 +0200
typed in alt.windows7.general the following:


The source code:

winmain::

jsr.l (GetCommandLine)



Hmmm - where/how do I put/use/invoke this?


Just execute the posted batch file. The binary of the
program is generated on the fly from the batch code
(using certutil to decode the base64 data at the end
of the file). Remove the "del settitle.exe" line if
you want to save the exe file.


Okay, I have been monkeying around with what you provided, and
finally got it to run. Cool beans.
Running it at the command line, it changes the window Title to
"ZZagaent", but as soon as it is done, that title goes away, reverts
to "Adminstorator:gettst". Settitle.exe, as far as I can tell, does
nothing. I included it a batchfile, the window apparently blinks into
existence for a second before closing. And the window of the dos
prompt changes to whatever title I set in the test file.

I tried to include it in the batchfile which calls agent (zz
agent) and ... no joy.
'settitle.exe is not recognized as an internal or ....
'----- Begin is not recognized ....

and so forth thorugh all the rest.
It does start Agent, but, that part was working already.


--
pyotr filipivich
Next month's Panel: Graft - Boon or blessing?
  #25  
Old September 23rd 18, 02:07 AM posted to alt.msdos.batch,alt.windows7.general
pyotr filipivich
external usenet poster
 
Posts: 752
Default how to get the title into task manger 'window'?

Herbert Kleebauer on Sat, 22 Sep 2018 08:04:13 +0200
typed in alt.windows7.general the following:
On 22.09.2018 03:08, Paul wrote:

This is the base64 stuff decoded.

https://i.postimg.cc/9FkYL8cn/hexdump.gif

I used this for base64 to binary.

https://www.base64decode.org/#decodefiles


No need to use an external decoder, the batch does the
decoding itself. cerutil is part of Windows since XP.

And this for trying a few opcodes to sync up to what

might be the code portion.

https://defuse.ca/online-x86-assembler.htm#disassembly2

No idea what it does, but that's a start at analysis.


I already posted the few lines of source code. Here the
listing from the assembler which explains the meaning
of every byte in the 1024 byte exe:


Wow.

One more reason I don't like programming at the assembler level.
B-)


--
pyotr filipivich
Next month's Panel: Graft - Boon or blessing?
  #26  
Old September 23rd 18, 03:09 AM posted to alt.msdos.batch,alt.windows7.general
Paul[_32_]
external usenet poster
 
Posts: 11,873
Default how to get the title into task manger 'window'?

pyotr filipivich wrote:
Herbert Kleebauer on Fri, 21 Sep 2018 21:00:39 +0200
typed in alt.windows7.general the following:
On 21.09.2018 17:17, pyotr filipivich wrote:
Herbert Kleebauer on Thu, 20 Sep 2018 21:58:37 +0200
typed in alt.windows7.general the following:
The source code:

winmain::

jsr.l (GetCommandLine)
Hmmm - where/how do I put/use/invoke this?

Just execute the posted batch file. The binary of the
program is generated on the fly from the batch code
(using certutil to decode the base64 data at the end
of the file). Remove the "del settitle.exe" line if
you want to save the exe file.


Okay, I have been monkeying around with what you provided, and
finally got it to run. Cool beans.
Running it at the command line, it changes the window Title to
"ZZagaent", but as soon as it is done, that title goes away, reverts
to "Adminstorator:gettst". Settitle.exe, as far as I can tell, does
nothing. I included it a batchfile, the window apparently blinks into
existence for a second before closing. And the window of the dos
prompt changes to whatever title I set in the test file.

I tried to include it in the batchfile which calls agent (zz
agent) and ... no joy.
'settitle.exe is not recognized as an internal or ....
'----- Begin is not recognized ....

and so forth thorugh all the rest.
It does start Agent, but, that part was working already.


You can save the file separately for later.
It should be 0x400 long (1024 bytes).

Once you have the file in hand, you can mess around
with it.

Paul
  #27  
Old September 23rd 18, 07:47 AM posted to alt.msdos.batch,alt.windows7.general
Herbert Kleebauer
external usenet poster
 
Posts: 27
Default how to get the title into task manger 'window'?

On 23.09.2018 02:43, pyotr filipivich wrote:

Running it at the command line, it changes the window Title to
"ZZagaent", but as soon as it is done, that title goes away, reverts
to "Adminstorator:gettst". Settitle.exe, as far as I can tell, does
nothing. I included it a batchfile, the window apparently blinks into
existence for a second before closing. And the window of the dos
prompt changes to whatever title I set in the test file.


Seems you didn't read my post:

|| As long as the batch is running, the title is changed. When
|| the batch has finished, then the title is reset by CMD to the
|| original text.


If you execute settitle.exe in a batch program, then the Window
title is set to the given string. Once the batch ends, cmd resets
the title to the old value. If you start it directly at the CMD
prompt, then immediately after the program is run, CMD resets the
title, so you will see only a short flashing of the new title.


I tried to include it in the batchfile which calls agent (zz
agent) and ... no joy.
'settitle.exe is not recognized as an internal or ....
'----- Begin is not recognized ....


settitle is not part of Windows, so if you don't create it yourself
on your PC then the batch doesn't find the program and you will get
the above error message.

But I told you how to create it. Either embed it directly in your
batch file (like in the given demo batch) or execute the given
demo batch without the line "del settitle.exe" and copy the
program to a directory which is in your %PATH% or in the directory
where your batch is running.

and so forth thorugh all the rest.
It does start Agent, but, that part was working already.


Again, execute the demo batch below (don't do any modification
to it). It will change the title and wait at the pause command,
so you can see the change of the title. After you press any key,
the pause command is skipped and the batch terminates, then cmd
resets the title to the old value.

:::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::
:::::::::::::::: start of batch ::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::

@echo off
certutil -f -decode %~f0 settitle.exenul

settitle.exe ZZ Home Agent Bat
pause

del settitle.exe
goto :eof

-----BEGIN CERTIFICATE-----
TVpgAQEAAAAEAAAA//8AAGABAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAoAAAAA4fug4AtAnNIbgBTM0hTmljZSB0by BtZWV0IHNvbWVi
b2R5IHdobyBpcyBzdGlsbCB1c2luZyBET1MsDQpidXQgdGhpcy Bwcm9ncmFtIHJl
cXVpcmVzIFdpbjMyLg0KJFBFAABMAQEAUHmlNgAAAAAAAAAA4A APAQsBBQwAAgAA
AAAAAAAAAADMEAAAABAAAAAgAAAAAEAAABAAAAACAAAFAAAAAA AAAAUAAAAAAAAA
ACAAAAACAAAAAAAAAwAAAAAAEAAAEAAAAAAQAAAQAAAAAAAAEA AAAAAAAAAAAAAA
GBAAADwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAQAAAYAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALnRleHQAAAACAQAAAB AAAAACAAAAAgAA
AAAAAAAAAAAAAAAAIAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABoEAAAAA AAAJgQAACqEAAA
vhAAAAAAAABgEAAAAAAAAAAAAABUEAAAABAAAIgQAAAAAAAAAA AAAHoQAAAIEAAA
AAAAAAAAAAAAAAAAAAAAAAAAAABVU0VSMzIuZGxsAABoEAAAAA AAAAAAU2V0V2lu
ZG93VGV4dEEAAEtFUk5FTDMyLmRsbAAAmBAAAKoQAAC+EAAAAA AAAAAAR2V0Q29t
bWFuZExpbmVBAAAAR2V0Q29uc29sZVdpbmRvdwAAAABFeGl0UH JvY2VzcwD/FQgQ
QAAx0khAgDgAdBGAOCJ1AvfSCdJ174A4IHXqQFD/FQwQQABQ/xUAEEAAagD/FRAQ
QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAA==
-----END CERTIFICATE-----

:::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::
:::::::::::::::: end of batch ::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::
  #28  
Old September 23rd 18, 08:04 AM posted to alt.msdos.batch,alt.windows7.general
Herbert Kleebauer
external usenet poster
 
Posts: 27
Default how to get the title into task manger 'window'?

On 23.09.2018 03:07, pyotr filipivich wrote:

I already posted the few lines of source code. Here the
listing from the assembler which explains the meaning
of every byte in the 1024 byte exe:


Wow.

One more reason I don't like programming at the assembler level.
B-)



What's wrong with this source code? It calls "GetCommandLine"
to get a pointer to the command line, then skips the program
name to get the pointer to the new title string given on
the command line. Then it gets the handle to the console
window (GetConsoleWindow), sets the new title (SetWindowTextA)
and terminates the program (ExitProcess). Anything else you see
in the list file is normally generated by the assembler and linker
(but if I want a small exe file to include it in a batch program,
I do it by hand). You can also write it as a two line C program, but
don't expect to get a 1 kByte binary.



winmain::

jsr.l (GetCommandLine)
; skip program name
eor.l r1,r1 ; not within "" flag
dec.l r0
_20: inc.l r0
cmp.b #0,(r0)
beq.b _10
cmp.b #'"',(r0)
bne.b _30
not.l r1
_30: or.l r1,r1
bne.b _20
cmp.b #' ',(r0)
bne.b _20
inc.l r0

_10: move.l r0,-(sp)
jsr.l (GetConsoleWindow)
move.l r0,-(sp)
jsr.l (SetWindowTextA)
moveq.l #0,-(sp)
jsr.l (ExitProcess) ; exit program
  #29  
Old September 23rd 18, 04:22 PM posted to alt.msdos.batch,alt.windows7.general
pyotr filipivich
external usenet poster
 
Posts: 752
Default how to get the title into task manger 'window'?

Herbert Kleebauer on Sun, 23 Sep 2018 09:04:29 +0200
typed in alt.windows7.general the following:
On 23.09.2018 03:07, pyotr filipivich wrote:

I already posted the few lines of source code. Here the
listing from the assembler which explains the meaning
of every byte in the 1024 byte exe:


Wow.

One more reason I don't like programming at the assembler level.
B-)



What's wrong with this source code?


I was talking about the assembler listing. Because I don't read
assembler, "TLDR".

It calls "GetCommandLine"
to get a pointer to the command line, then skips the program
name to get the pointer to the new title string given on
the command line. Then it gets the handle to the console
window (GetConsoleWindow), sets the new title (SetWindowTextA)
and terminates the program (ExitProcess). Anything else you see
in the list file is normally generated by the assembler and linker
(but if I want a small exe file to include it in a batch program,
I do it by hand). You can also write it as a two line C program, but
don't expect to get a 1 kByte binary.


Now, how do I get a Shortcut (Filename.lnk) to do this? How do I
get a batchfile to change the title from "Administrator: Filename" to
"Filename"? I see this code setting the title to "ZZ Agent", but when
I add it to ZZ Agent.bat - I don't see any change.

Yes, I know I am whining. But it is not intuitively obvious, to
me, and if I had a C compiler, there are a number of things I could
"do for myself". (I had a small C program which stripped out
non-printing characters, just great for massaging and clearing up
downloaded text files.


winmain::

jsr.l (GetCommandLine)
; skip program name
eor.l r1,r1 ; not within "" flag
dec.l r0
_20: inc.l r0
cmp.b #0,(r0)
beq.b _10
cmp.b #'"',(r0)
bne.b _30
not.l r1
_30: or.l r1,r1
bne.b _20
cmp.b #' ',(r0)
bne.b _20
inc.l r0

_10: move.l r0,-(sp)
jsr.l (GetConsoleWindow)
move.l r0,-(sp)
jsr.l (SetWindowTextA)
moveq.l #0,-(sp)
jsr.l (ExitProcess) ; exit program

--
pyotr filipivich
Next month's Panel: Graft - Boon or blessing?
  #30  
Old September 23rd 18, 04:22 PM posted to alt.msdos.batch,alt.windows7.general
pyotr filipivich
external usenet poster
 
Posts: 752
Default how to get the title into task manger 'window'?

Herbert Kleebauer on Sun, 23 Sep 2018 08:47:06 +0200
typed in alt.windows7.general the following:

Again, execute the demo batch below (don't do any modification
to it). It will change the title and wait at the pause command,
so you can see the change of the title. After you press any key,
the pause command is skipped and the batch terminates, then cmd
resets the title to the old value.


Okay, I make this batchfile. It compiles a program
"SetTitle.exe", which because I was doing all this in C:\Sandbox, was
not found by ZZ Agent.Bat. So, I need to have this code compile to
c:\{PATH} so that the batchfile can find it?

::::::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::
:::::::::::::::: start of batch ::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::

@echo off
certutil -f -decode %~f0 settitle.exenul


can I change this to
certutil -f -decode %~f0 c:\progs\settitle.exenul
and have it work? {I know, I know, I should try it and see. B-)}

settitle.exe ZZ Home Agent Bat


Second question: is this invoked by

settitle.exe [New Title]

For use with other programs?

pause

del settitle.exe
goto :eof

--
pyotr filipivich
Next month's Panel: Graft - Boon or blessing?
 




Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off






All times are GMT +1. The time now is 04:01 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 PCbanter.
The comments are property of their posters.