flat assembler
Message board for the users of flat assembler.

Index > Windows > Start menu button and etc

Author
Thread Post new topic Reply to topic
NEOAethyr



Joined: 20 Aug 2007
Posts: 19
NEOAethyr
Anyone got a short working example for removing the start menu from view like start killer does?

I'de like to hide it, and ensure that the spot where it was at is used by the taskbar instead.
Maybe outright disable it.

I got start killer but it needs to be running at all times, I'de rather have something that only runs at startup once and exits on it's own.


I'de also like to remove the normalize/maximize button and replace the spot it takes up with the minimize buttton.


I've found vb src code for hiding the start menu button but I can't seems to compile them in visual basic express 2008.
I don't like c or basic so I have no idea what the deal is.
Asm though I can understand that but I can't find any examples that do this stuff.
Post 02 Aug 2010, 07:24
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17253
Location: In your JS exploiting you and your system
revolution
I've never tried it but apparently setting/deleting this registry key will disable/enable the start button. I expect you would have to restart explorer.exe for it take effect. Let us know if it works.
Post 02 Aug 2010, 07:47
View user's profile Send private message Visit poster's website Reply with quote
NEOAethyr



Joined: 20 Aug 2007
Posts: 19
NEOAethyr
I've never seen a - in the middle of a reg key before, I don't know if that works or not.
I just went into regedit, backed up the key and del'ed it manually.

Reg file would of went:
Code:
[-HKEY_CLASSES_ROOT\CLSID\{5b4dae26-b807-11d0-9815-00c04fd91972}]
    


It doesn't actually work as intended though.
What this is, is the quick luanch popup menu that you get when you have a arrow in the quicklaunch, if you know what I mean.

This class id is a potential for using to replace the win7 start menu for sure, might be possible to make a classic start menu wihtout some 3rd part app.
I'll have to check into it later.


Anyways after I del'ed the key, I restarted (making sure to get rid of start kiler form my run key's).
Noticed what it actually did and then I ran my backup, no restart needed, my custom quicklaunch menu worked again.


I'lll try to bring up a list of codes that do what I'm looking for (but I can't compile)

VB:
Code:
Sub main()
    Dim lHwnd As Long
    lHwnd = FindWindowEx(0&, 0&, "Shell_TrayWnd", vbNullString)
    lHwnd = FindWindowEx(lHwnd, 0&, "Button", vbNullString)

    Select Case LCase(Command$)
        Case "/hide"
            Call ShowWindow(lHwnd, 0)
        Case "/show"
            Call ShowWindow(lHwnd, 1)
        Case "/disable"
            Call EnableWindow(lHwnd, 0)
        Case "/enable"
            Call EnableWindow(lHwnd, 1)
        Case Else
            MsgBox "Please use on of the following switches: " & vbCrLf & _
                   "/hide       - Hides start button" & vbCrLf & _
                   "/show       - Shows start button" & vbCrLf & _
                   "/enable     - Enables start button" & vbCrLf & _
                   "/disable    - Disables start button" & vbCrLf & vbCrLf & _
                   "(c) Asaf Ganot www.smart-x.com", vbInformation, "StartBut.exe"
    End Select
End Sub
    


Code:
I don't know any ready method of doing this in "pure" script.

However, if you are willing to delve into the nether-world
of calling system api's from script, it is easy.

Here is what you do.  Use the FindWindow api to get the handle
of the "Shell_TrayWnd" class (no caption) window.  Then use
FindWindowEx to get the handle of the (first) child window,
with class name "Button" (and no caption).  Then you call the
ShowWindow api with the "SW_HIDE" constant to hide the
(start) button.

Note that there is another api to lock the keyboard (and mouse),
because even without the start button, your users could get
something going from desktop shortcuts.
    


Code:
'Disable/Enable Start button 
    Public Sub StartButton(ByRef show As Boolean)
        Dim primo As Integer
        Dim ultimo As Integer

        primo = FindWindow("Shell_TrayWnd", "")
        ultimo = FindWindowEx(primo, 0, "Button", vbNullString)
        If show = True Then
            ShowWindow(ultimo, 5) 'show start button
        Else
            ShowWindow(ultimo, 0) 'hide start button
        End If
    End Sub

and now code to block ctl+ Esc keys

'System level functions to be used for hook and unhook keyboard input
    Private Delegate Function LowLevelKeyboardProc(ByVal nCode As Integer, ByVal wParam As IntPtr, ByVal lParam As IntPtr) As IntPtr
    <DllImport("user32.dll", CharSet:=CharSet.Auto, SetLastError:=True)> _
    Private Shared Function SetWindowsHookEx(ByVal id As Integer, ByVal callback As LowLevelKeyboardProc, ByVal hMod As IntPtr, ByVal dwThreadId As UInteger) As IntPtr
    End Function
    <DllImport("user32.dll", CharSet:=CharSet.Auto, SetLastError:=True)> _
    Private Shared Function UnhookWindowsHookEx(ByVal hook As IntPtr) As Boolean
    End Function
    <DllImport("user32.dll", CharSet:=CharSet.Auto, SetLastError:=True)> _
    Private Shared Function CallNextHookEx(ByVal hook As IntPtr, ByVal nCode As Integer, ByVal wp As IntPtr, ByVal lp As IntPtr) As IntPtr
    End Function
    <DllImport("kernel32.dll", CharSet:=CharSet.Auto, SetLastError:=True)> _
    Private Shared Function GetModuleHandle(ByVal name As String) As IntPtr
    End Function
    <DllImport("user32.dll", CharSet:=CharSet.Auto)> _
    Private Shared Function GetAsyncKeyState(ByVal key As Keys) As Short
    End Function

    'Declaring Global objects
    Private ptrHook As IntPtr
    Private objKeyboardProcess As LowLevelKeyboardProc
    Public Sub New()
        Dim objCurrentModule As ProcessModule = Process.GetCurrentProcess().MainModule
        'Get Current Module
        objKeyboardProcess = New LowLevelKeyboardProc(AddressOf captureKey)
        'Assign callback function each time keyboard process
        ptrHook = SetWindowsHookEx(13, objKeyboardProcess, GetModuleHandle(objCurrentModule.ModuleName), 0)
        'Setting Hook of Keyboard Process for current module
        ' This call is required by the Windows Form Designer.
        InitializeComponent()

        ' Add any initialization after the InitializeComponent() call.

    End Sub

    Private Function captureKey(ByVal nCode As Integer, ByVal wp As IntPtr, ByVal lp As IntPtr) As IntPtr
        If nCode >= 0 Then
            Dim objKeyInfo As KBDLLHOOKSTRUCT = DirectCast(Marshal.PtrToStructure(lp, GetType(KBDLLHOOKSTRUCT)), KBDLLHOOKSTRUCT)

            If objKeyInfo.key = Keys.RWin OrElse objKeyInfo.key = Keys.LWin Then
                ' Disabling Windows keys
                Return CType(1, IntPtr)
            End If

            If objKeyInfo.key = Keys.ControlKey OrElse objKeyInfo.key = Keys.Escape Then
                ' Disabling Ctrl + Esc keys
                Return CType(1, IntPtr)
            End If

            If objKeyInfo.key = Keys.Alt OrElse objKeyInfo.key = Keys.F4 Then
                ' Disabling Alt + F4 keys
                'Return CType(1, IntPtr)
                frmPassword.Visible = True
            End If

            If objKeyInfo.key = Keys.Alt OrElse objKeyInfo.key = Keys.Tab Then
                ' Disabling Alt + Tab keys
                Return CType(1, IntPtr)
            End If

        End If
        Return CallNextHookEx(ptrHook, nCode, wp, lp)
    End Function
    


I only neeed to hide the start button from view, I don't need to hook the keyboard.

I can see some of the api's used and import file needed but I have no idea how to use them from these examples of code.


If I go about hacking the files with a res hacker, I can replace the start button images with blanks.
But all that does is leave a blank area on my taskbar where the button should be.
I'de like to beable to hide the thing and make it so I can't click on it.

The reason why I want to do this is not so I can exploit someone's system by removing access to there software.
I just wanna remove my start button so I can go on using my custom quicklaunch menu folder setup.
Without using a 3rd party app that uses a meg or 2 of mem at all times lol.

(I don't like seeing startkiller in my taskmanager...)

If anyone can make a fasm ver of the code that does this, that would be great.
Not with an empty space on the taskbar though, not sure what just hiding it would do but it would be a start.
Hopefully it'll move the taskbar items to the spot where the start button used to be.


Edit:
Like I mentioned before, another thing I would like to do is hide/remove the max/normalize button in all windows.
I don't use it, I just double click on the title's to do the same.

One other thing I'de liek to remove/hide is the aero peak button.
Disabling it, screws up taskbar task previews.
And doesn't remove the button.

And again if I res hack that, the area is still used up by an invisable button, with the clock hovering over it.

It annoys the heck out of me when I'm typing somehting and my windows all dissapear from view because my mouse accidently hovered over that button.
It seems to happen to me alot lol.


I suppose an alternative would be soem fasm src of a taskbar replacement, with working taskbar stuffs and icon stuff int eh corner.
Plus taskbar previews..
If anyone has somehting liek that to replace explorer with.

Otherwise I'm content wiith using api's to gut some of the stuff I don't want.

Or more interesting reg hacks...
Post 02 Aug 2010, 09:09
View user's profile Send private message Reply with quote
sinsi



Joined: 10 Aug 2007
Posts: 692
Location: Adelaide
sinsi
One problem is that the desktop refreshes itself quite often, any changes you make will be wiped out (I had my icon titles in yellow and they used to get changed back to default at ...odd times). Vista/win7 seem to protect the desktop too.

One reason the start killer runs all the time (probably) is to keep checking things and change them when the shell goes to default mode.

Just drag the taskbar to the bottom or auto-hide it Very Happy
Post 02 Aug 2010, 09:21
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17253
Location: In your JS exploiting you and your system
revolution
This "works" on my XPSP2 box:
Code:
include 'win32ax.inc'

.code

begin:
        invoke  FindWindowEx,0,0,'Shell_TrayWnd',0
        invoke  FindWindowEx,eax,0,'Button',0
     invoke  ShowWindow,eax,0
    invoke  ExitProcess,0

.end begin    
But it only hides the button. The space is left blank.

But I can still access the start menu by pointing the mouse hard to the left edge and clicking.
Post 02 Aug 2010, 09:24
View user's profile Send private message Visit poster's website Reply with quote
sinsi



Joined: 10 Aug 2007
Posts: 692
Location: Adelaide
sinsi
You could get the hwnd of the start button and make its size 0,0.
You might also need to adjust the size of the taskbar (rebar?)
Post 02 Aug 2010, 09:28
View user's profile Send private message Reply with quote
NEOAethyr



Joined: 20 Aug 2007
Posts: 19
NEOAethyr
I see's...
That would suck, but I've read one of the vb pages somewhere on this that when you hide the taskbar or start button it doesn't come back until you restart.

I suppose it's possible that it could come back up if the theme was chnaged or something though.


I use the taskbar, I got a 1080p monitor.
I got it on the right side of my screen using a custom setup of opera as my browser.
Works pretty good.

I don't like how fat it is though.
In winxp/2k3 if I do the same thing I can make it skinny and decent looking.


Since tonight I've been thinking about a explorer replacement.
I've thaught about it before and looked but never found anything decent.
They all had missing notification area's that are used the corner of the taskbar.

I would be interested in making one using gfasm but I have pretty much no experience with win32.
I've only messed with it a few times for the heck of it, couldn't ever do anything useful for it.

It's something I have to get into because in win7, the int21 and vesa mode stuff is gone from normal dos apps.


Offtopic wise... ^^
Might anyone here have some fasm code to get ring0 in win7 x86 or access to direct hardware?
It's preventing me from doing os/bios work.

That and windows hanging onto file handles (com's, bat's and exe's) for a min or 2 which is super annoying (#1 reason why I haven't been programming for the last year).
Post 02 Aug 2010, 09:32
View user's profile Send private message Reply with quote
NEOAethyr



Joined: 20 Aug 2007
Posts: 19
NEOAethyr
Lol, you guys are fast, thanks revolution for the code above I'll check it out on win7.
It's a step closer Smile.
Post 02 Aug 2010, 09:33
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17253
Location: In your JS exploiting you and your system
revolution
NEOAethyr wrote:
Might anyone here have some fasm code to get ring0 in win7 x86 or access to direct hardware?
On win7 you have to have signed drivers or boot in special unsigned driver mode. Do you know someone that has registered (and paid) and can sign your drivers?
Post 02 Aug 2010, 09:40
View user's profile Send private message Visit poster's website Reply with quote
sinsi



Joined: 10 Aug 2007
Posts: 692
Location: Adelaide
sinsi
Code:
rebar db 'ReBarWindow32',0    
That's the taskbar
Post 02 Aug 2010, 09:58
View user's profile Send private message Reply with quote
NEOAethyr



Joined: 20 Aug 2007
Posts: 19
NEOAethyr
No I don't Sad.
I have it in kernal debug mode and have x64 mode unsigned driver support setup for the bootmgr.

In windows I have unsigned driver support enabled.

Before I got into kernal debug mode I tried hacking the kernal for support for more then 3gigs, bsod's.
I haven't tried that since.
Might work now.

What I'm looking to do with ring0 is access mem and ports directly so I can dump stuff for bios work.
I also want to make a temp monitoring program for windows, I've made one before for my modded bios on my old board, the dfi nf2, using a pci rom module with a device id of the chipset, replacing the normally not working nvidia lan boot rom.

When I use the chipset it's self as the id it forces the rom to start even when the cmos option for it is disabled, ie the realtek lan rom.
Since the nvidia rom never worked in the 1st place that is the one I use to replace (another one I replaced before in the past was the sata raid rom).

This probably works on new boards too, making a pci rom with the id of the chipset (say amd north bridge on the cpu).

I had to use a special class to make it happen, I used:
db 0x00, 0x00, 0x0B ;Processor

Board automatically runs it.

In my rom I would parse the cmos for a single byte to see if I should load my custom debug rom os, or continue booting in 3 ways.

ie:

Code:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Init
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Init:

call Get_Entry_Point

lea di, [Entry_Point+bx]   ;Store The Entry Ptr In Memory
mov [cs:di], bx
mov ax, cs
mov [cs:di+0x0002], ax

call Scan_ENV

lea di, [OS_Flag+bx]
cmp byte [cs:di], 0x01                ;Check for DOS
jb ROM_Init
je DOS_Init
ja NT_Init

jmp Exit                      ;just incase

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ROM_Init
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

ROM_Init:
je Check_CMOS                   ;checks for a certain cmos offset to see how it should behave when exiting
Check_CMOS_End:

call Get_Entry_Point           ;I might need this for now...

call Get_IVT
;call Set_IVT


call Setup_SVGA
call Clear_Screen

mov si, Msg_Main_Menu
call SVGA_Print_String

TEST_LOOP:
jmp TEST_LOOP

call Get_VGA_Mode_TXT
lea di, [Default_VGA_Mode+bx]
mov [cs:di], al
lea di, [VGA_Mode+bx]
mov byte [cs:di], 0x03
call Set_VGA_Mode_TXT

call Main_Menu_TXT

jmp Exit

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; DOS_Init
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

DOS_Init:
call Get_Entry_Point         ;I might need this for now...

call Get_IVT
call Set_IVT
call Set_DTA

call Get_VGA_Mode_TXT
lea di, [Default_VGA_Mode+bx]
mov [cs:di], al
lea di, [VGA_Mode+bx]
mov byte [cs:di], 0x03
call Set_VGA_Mode_TXT

call Command_Window
;call Main_Menu_TXT

jmp Exit

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; NT_Init
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

NT_Init:
call Get_Entry_Point          ;I might need this for now...
call Set_DTA

mov ax, bx
mov di, Text_Color           ;Text Color
add di, ax
mov dword [cs:di], 0x00FFFFFF
mov di, Text_BG_Color         ;Text Background Color
add di, ax
mov dword [cs:di], 0xFF000000
mov di, BG_Color           ;Background Color
add di, ax
mov dword [cs:di], 0x00005077

;call Setup_SVGA
;call Clear_Screen

;mov si, Msg_Main_Menu
;call SVGA_Print_String
;call Main_Menu

;TEST_LOOP:
;jmp TEST_LOOP

;call Get_Entry_Point            ;I might need this for now...
call Get_VGA_Mode_TXT

call Command_Window
;call Main_Menu_TXT

jmp Exit

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Exit
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Exit:                                ;The OS Exits this way when not in ROM
lea si, [OS_Flag+bx]
cmp byte [cs:si], 0x00
je ROM_Exit
lea si, [Default_VGA_Mode+bx]
lea di, [VGA_Mode+bx]
mov al, [cs:si]
mov [cs:di], al
call Set_VGA_Mode_TXT
ret

ROM_Exit:                        ;ROM Exits the OS this way
lea dx, [Msg_Exit+bx]
call Print_String
ROM_Exit_Loop:                  ;Do this so we can get to the boot menu in the BIOS
call Dump_Keyboard
cmp ah, 0x01                       ;Esc key
jne ROM_Exit_Loop
ROM_Exit_Loop_Ret:
lea si, [Default_VGA_Mode+bx]
lea di, [VGA_Mode+bx]
mov al, [cs:si]
mov [cs:di], al
call Set_VGA_Mode_TXT
retf

ROM_Exit_2:                 ;Optional Quick Exit (CMOS)
retf

Strap_Exit:                      ;Hijacks the system by leaving it's code in shadow ram, it doesn't ever return though for now
dw 0x19CD                    ;Skip the DMI Pooling and CMOS Backing up..., skips boot menu too Sad, and fails to set vga mode
jmp Exit                     ;Just incase for something

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    


The above just to show what I'm talking about, way offtopic lol.
It handles varibles that way because the os can run in shadow ram, in dos or windows cmd line with the same file (rom ver is compilied slightly diff though for obvious reasons).
Apperently I was in the middle of something in the above and left it in a test phase lol.


Anyways I tried the win32 code that was posted but it doesn't seem to work in win7.
Somewhere on gogole someone had said that there was another way of doing it that worked in xp and win7.

I'll be installing win2k3 in a few days so I suppose I can try it in that os when I do.


As for my rom module code(and com file), if I can get back into a decent os, win2k3, I'll fix it up and post the basic portion of it.
Post 02 Aug 2010, 09:59
View user's profile Send private message Reply with quote
NEOAethyr



Joined: 20 Aug 2007
Posts: 19
NEOAethyr
Ok I got my windows 2003 up and running.
The code:

Code:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

include "win32ax.inc"

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Code Section
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

.code

begin:

invoke FindWindowEx,0,0,'Shell_TrayWnd',0
invoke FindWindowEx,eax,0,'Button',0
invoke ShowWindow,eax,0
invoke ExitProcess,0

.end begin

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    


That works in win2k3 but not win7.

What I'm most interested in at the moment is how to redo the taskbar position to replace the now hidden start button.

Anyone got any ideas ?
Sorry but like I mentioned before, I'm totally not experienced in win32 yet.
Post 09 Aug 2010, 12:02
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.