April 24, 2024, 01:22:51 AM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Is this a virus or trojan problem or something wrong with my code?

Started by AdrianFox, November 20, 2009, 05:45:25 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

AdrianFox

I've been having problems running the program below after it seems to compile ok.

Sometimes I can click on the 'Choose New Passage" button and it will loop twice before hanging.  (I've reinitialised data and variables). Executing the exe again it will only loop once.  Sometimes on recompiling the same code it won't work at all.

I ran 'Debug' and found the two following lines in the debug code:  I've bolded the two suspicious ones.

Starting debug session...
Loading DLL: ntdll.dll
Loading DLL: C:\WINDOWS\system32\kernel32.dll
Loading DLL: C:\WINDOWS\system32\USER32.DLL
Loading DLL: C:\WINDOWS\system32\GDI32.dll
Loading DLL: C:\WINDOWS\system32\OLE32.DLL
Loading DLL: C:\WINDOWS\system32\ADVAPI32.dll
Loading DLL: C:\WINDOWS\system32\RPCRT4.dll
Loading DLL: C:\WINDOWS\system32\Secur32.dll
Loading DLL: C:\WINDOWS\system32\msvcrt.dll
Loading DLL: C:\WINDOWS\system32\COMCTL32.DLL
Loading DLL: C:\WINDOWS\system32\CRTDLL.DLL
Loading DLL: C:\WINDOWS\system32\IMM32.DLL
Loading DLL: C:\PROGRA~1\Google\GOOGLE~2\GOEC62~1.DLL
Loading DLL: C:\WINDOWS\system32\WS2_32.dll
Loading DLL: C:\WINDOWS\system32\WS2HELP.dll
Loading DLL: C:\WINDOWS\system32\MSCTF.dll
Loading DLL: C:\WINDOWS\system32\version.dll
Loading DLL: C:\WINDOWS\system32\msctfime.ime
Loading DLL: C:\WINDOWS\system32\mslbui.dll
Loading DLL: C:\Program Files\IncrediMail\bin\B4ImApp.dll
Loading DLL: C:\WINDOWS\system32\OLEAUT32.dll
Loading DLL: C:\WINDOWS\system32\SHLWAPI.dll
The program 'C:\EmergenceBasic\Experiments\textarrange\resequencing2.exe' exited with code: 0

Why is my program trying to load DLLs from my email program (Incredimail) and Google?  I'm not using any code relevant to either!
Or does the compiler do this anyway in case they are needed.
Am I being paranoid and it's just my bad code?

Bizarrely the second bolded item only appeared the second time I ran the compiler with 'debug' on.

Do you have any idea what is happening here?  I removed a malware DLL yesterday and am running up-to-date AVG anti virus.

Any help, reassurance or advice would be very welcome.


'$include "prologue.inc" (loaded in the sub in main program... it's just 10 data statements of simple text)

'PUT DEFINITIONS HERE

CONST  EDIT1 = 1
CONST  EDIT2 = 2
CONST  EDIT3 = 3
CONST  EDIT4 = 4
CONST  EDIT5 = 5
CONST  EDIT6 = 6
CONST  EDIT7 = 7
CONST  EDIT8 = 8
CONST  EDIT9 = 9
CONST  EDIT10 = 10
CONST  EDIT11 = 11
CONST  EDIT12 = 12
CONST  EDIT13 = 13
CONST  EDIT14 = 14
CONST  EDIT15 = 15
CONST  EDIT16 = 16
CONST  EDIT17 = 17
CONST  EDIT18 = 18
CONST  EDIT19 = 19
CONST  EDIT20 = 20
CONST  STATIC1 = 21
const  static2=22
CONST  COMBO1 = 23
CONST  COMBO2 = 24
CONST  COMBO3 = 25
CONST  COMBO4 = 26
CONST  COMBO5 = 27
CONST  COMBO6 = 28
CONST  COMBO7 = 29
CONST  COMBO8 = 30
CONST  COMBO9 = 31
CONST  COMBO10 = 32
CONST  BUTTON1 = 33
CONST  BUTTON2 = 34
CONST  BUTTON3 = 35
CONST  BUTTON4 = 36
CONST  BUTTON5 = 37
CONST  BUTTON6 = 38
CONST  BUTTON7 = 39
CONST  BUTTON8 = 40
CONST  BUTTON9 = 41
CONST  BUTTON10 = 42
CONST  BUTTON12 = 43
CONST  BUTTON13 = 44
CONST  BUTTON14 = 45


def datatext as STRING
def savedstring as STRING




'END OF DEFINITIONS



WINDOW MAIN

OpenWindow main,0,0,1193,650,@SIZE|@MINBOX|@MAXBOX|@CAPTION|@SYSMENU,0,"Resequencing Exercise: Chaucer's Wife of Bath",& mainhandler

Control main,@Edit,"",12,70,460,40,@CTEDITAUTOH,EDIT1
Control main,@Edit,"",12,110,460,40,@CTEDITAUTOH, EDIT2
Control main,@Static,"The lines on the left are not printed in the correct order. By selecting the correct number of each line, rearrange the text to the right with the correct order.  Select the number in the drop down list and then click the relevant move button.",6,14,1167,50,0, STATIC1
control main,@static,"Click on the '1' in the box, and use up/down arrow keys to select its true line position.",480,500,100,140,0x50000101, STATIC2
Control main,@Edit,"",12,150,460,40,@CTEDITAUTOH, EDIT3
Control main,@Edit,"",12,190,460,40,@CTEDITAUTOH, EDIT4
Control main,@Edit,"",12,230,460,40,@CTEDITAUTOH, EDIT5
Control main,@Edit,"",12,270,460,40,@CTEDITAUTOH, EDIT6
Control main,@Edit,"",12,310,460,40,@CTEDITAUTOH, EDIT7
Control main,@Edit,"",12,350,460,40,@CTEDITAUTOH, EDIT8
Control main,@Edit,"",12,390,460,40,@CTEDITAUTOH, EDIT9
Control main,@Edit,"",12,430,460,40,@CTEDITAUTOH, EDIT10
Control main,@Edit,"",640,70,460,40,@CTEDITAUTOH, EDIT11
Control main,@Edit,"",640,110,460,40,@CTEDITAUTOH, EDIT12
Control main,@Edit,"",640,150,460,40,@CTEDITAUTOH, EDIT13
Control main,@Edit,"",640,190,460,40,@CTEDITAUTOH, EDIT14
Control main,@Edit,"",640,230,460,40,@CTEDITAUTOH, EDIT15
Control main,@Edit,"",640,270,460,40,@CTEDITAUTOH, EDIT16
Control main,@Edit,"",640,310,460,40,@CTEDITAUTOH, EDIT17
Control main,@Edit,"",640,350,460,40,@CTEDITAUTOH, EDIT18
Control main,@Edit,"",640,390,460,40,@CTEDITAUTOH, EDIT19
Control main,@Edit,"",640,430,460,40,@CTEDITAUTOH, EDIT20
Control main,@Combobox,"",480,80,60,24,0x50A00602, COMBO1
Control main,@Combobox,"",480,120,60,24,0x50A00602, COMBO2
Control main,@Combobox,"",480,160,60,24,0x50A00602, COMBO3
Control main,@Combobox,"",480,200,60,24,0x50A00602, COMBO4
Control main,@Combobox,"",480,240,60,24,0x50A00602, COMBO5
Control main,@Combobox,"",480,280,60,24,0x50A00602, COMBO6
Control main,@Combobox,"",480,320,60,24,0x50A00602, COMBO7
Control main,@Combobox,"",480,360,60,24,0x50A00602, COMBO8
Control main,@Combobox,"",480,400,60,24,0x50A00602, COMBO9
Control main,@Combobox,"",480,440,60,24,0x50A00602, COMBO10
Control main,@SysButton,"MOVE",540,80,60,25,0, BUTTON1
Control main,@SysButton,"MOVE",540,120,60,25,0, BUTTON2
Control main,@SysButton,"MOVE",540,160,60,25,0, BUTTON3
Control main,@SysButton,"MOVE",540,200,60,25,0, BUTTON4
Control main,@SysButton,"MOVE",540,240,60,25,0, BUTTON5
Control main,@SysButton,"MOVE",540,280,60,25,0, BUTTON6
Control main,@SysButton,"MOVE",540,320,60,25,0, BUTTON7
Control main,@SysButton,"MOVE",540,360,60,25,0, BUTTON8
Control main,@SysButton,"MOVE",540,400,60,25,0, BUTTON9
Control main,@SysButton,"MOVE",540,440,60,25,0, BUTTON10
Control main,@SysButton,"Check Sequence",982,500,165,69,0, BUTTON12
Control main,@SysButton,"Choose a new passage",723,500,225,71,0, BUTTON13
Control main,@SysButton,"Quit",20,500,118,63,0, BUTTON14

SetFont main,"Times New Roman",10,400,0
SetWindowColor main, RGB(255,128,255)
FrontPen main, RGB(0,0,0)
SetFont main,"Times New Roman",12,400,0,  STATIC1
SetControlColor main,  STATIC1,RGB(0,0,0),RGB(255,128,255)
SetFont main,"Times New Roman",12,400,0,  STATIC2
SetControlColor main,  STATIC2,RGB(0,0,0),RGB(255,128,255)
SetFont main,"Tahoma",10,400,0,  EDIT1
SetControlColor main,  EDIT1,RGB(0,0,0),RGB(255,255,255)
SetFont main,"Tahoma",10,400,0,  EDIT2
SetControlColor main,  EDIT2,RGB(0,0,0),RGB(255,255,255)
SetFont main,"Tahoma",10,400,0,  EDIT3
SetControlColor main,  EDIT3,RGB(0,0,0),RGB(255,255,255)
SetFont main,"Tahoma",10,400,0,  EDIT4
SetControlColor main,  EDIT4,RGB(0,0,0),RGB(255,255,255)
SetFont main,"Tahoma",10,400,0,  EDIT5
SetControlColor main,  EDIT5,RGB(0,0,0),RGB(255,255,255)
SetFont main,"Tahoma",10,400,0,  EDIT6
SetControlColor main,  EDIT6,RGB(0,0,0),RGB(255,255,255)
SetFont main,"Tahoma",10,400,0,  EDIT7
SetControlColor main,  EDIT7,RGB(0,0,0),RGB(255,255,255)
SetFont main,"Tahoma",10,400,0,  EDIT8
SetControlColor main,  EDIT8,RGB(0,0,0),RGB(255,255,255)
SetFont main,"Tahoma",10,400,0,  EDIT9
SetControlColor main,  EDIT9,RGB(0,0,0),RGB(255,255,255)
SetFont main,"Tahoma",10,400,0,  EDIT10
SetControlColor main,  EDIT10,RGB(0,0,0),RGB(255,255,255)
SetFont main,"Tahoma",10,400,0,  EDIT11
SetControlColor main,  EDIT11,RGB(0,0,0),RGB(255,255,255)
SetFont main,"Tahoma",10,400,0,  EDIT12
SetControlColor main,  EDIT12,RGB(0,0,0),RGB(255,255,255)
SetFont main,"Tahoma",10,400,0,  EDIT13
SetControlColor main,  EDIT13,RGB(0,0,0),RGB(255,255,255)
SetFont main,"Tahoma",10,400,0,  EDIT14
SetControlColor main,  EDIT14,RGB(0,0,0),RGB(255,255,255)
SetFont main,"Tahoma",10,400,0,  EDIT15
SetControlColor main,  EDIT15,RGB(0,0,0),RGB(255,255,255)
SetFont main,"Tahoma",10,400,0,  EDIT16
SetControlColor main,  EDIT16,RGB(0,0,0),RGB(255,255,255)
SetFont main,"Tahoma",10,400,0,  EDIT17
SetControlColor main,  EDIT17,RGB(0,0,0),RGB(255,255,255)
SetFont main,"Tahoma",10,400,0,  EDIT18
SetControlColor main,  EDIT18,RGB(0,0,0),RGB(255,255,255)
SetFont main,"Tahoma",10,400,0,  EDIT19
SetControlColor main,  EDIT19,RGB(0,0,0),RGB(255,255,255)
SetFont main,"Tahoma",10,400,0,  EDIT20
SetControlColor main,  EDIT20,RGB(0,0,0),RGB(255,255,255)
SetFont main,"Tahoma",10,400,0,  COMBO1
SetControlColor main,  COMBO1,RGB(0,0,0),RGB(255,255,255)
SetFont main,"Tahoma",10,400,0,  COMBO2
SetControlColor main,  COMBO2,RGB(0,0,0),RGB(255,255,255)
SetFont main,"Tahoma",10,400,0,  COMBO3
SetControlColor main,  COMBO3,RGB(0,0,0),RGB(255,255,255)
SetFont main,"Tahoma",10,400,0,  COMBO4
SetControlColor main,  COMBO4,RGB(0,0,0),RGB(255,255,255)
SetFont main,"Tahoma",10,400,0,  COMBO5
SetControlColor main,  COMBO5,RGB(0,0,0),RGB(255,255,255)
SetFont main,"Tahoma",10,400,0,  COMBO6
SetControlColor main,  COMBO6,RGB(0,0,0),RGB(255,255,255)
SetFont main,"Tahoma",10,400,0,  COMBO7
SetControlColor main,  COMBO7,RGB(0,0,0),RGB(255,255,255)
SetFont main,"Tahoma",10,400,0,  COMBO8
SetControlColor main,  COMBO8,RGB(0,0,0),RGB(255,255,255)
SetFont main,"Tahoma",10,400,0,  COMBO9
SetControlColor main,  COMBO9,RGB(0,0,0),RGB(255,255,255)
SetFont main,"Tahoma",10,400,0,  COMBO10
SetControlColor main,  COMBO10,RGB(0,0,0),RGB(255,255,255)
SetFont main,"Tahoma",10,400,0,  BUTTON1
SetControlColor main,  BUTTON1,RGB(0,0,0),RGB(212,208,200)
SetFont main,"Tahoma",10,400,0,  BUTTON2
SetControlColor main,  BUTTON2,RGB(0,0,0),RGB(212,208,200)
SetFont main,"Tahoma",10,400,0,  BUTTON3
SetControlColor main,  BUTTON3,RGB(0,0,0),RGB(212,208,200)
SetFont main,"Tahoma",10,400,0,  BUTTON4
SetControlColor main,  BUTTON4,RGB(0,0,0),RGB(212,208,200)
SetFont main,"Tahoma",10,400,0,  BUTTON5
SetControlColor main,  BUTTON5,RGB(0,0,0),RGB(212,208,200)
SetFont main,"Tahoma",10,400,0,  BUTTON6
SetControlColor main,  BUTTON6,RGB(0,0,0),RGB(212,208,200)
SetFont main,"Tahoma",10,400,0,  BUTTON7
SetControlColor main,  BUTTON7,RGB(0,0,0),RGB(212,208,200)
SetFont main,"Tahoma",10,400,0,  BUTTON8
SetControlColor main,  BUTTON8,RGB(0,0,0),RGB(212,208,200)
SetFont main,"Tahoma",10,400,0,  BUTTON9
SetControlColor main,  BUTTON9,RGB(0,0,0),RGB(212,208,200)
SetFont main,"Tahoma",10,400,0,  BUTTON10
SetControlColor main,  BUTTON10,RGB(0,0,0),RGB(212,208,200)
SetFont main,"Times New Roman",14,700,0,  BUTTON12
SetControlColor main,  BUTTON12,RGB(0,0,0),RGB(212,208,200)
SetFont main,"Times New Roman",14,700,0,  BUTTON13
SetControlColor main,  BUTTON13,RGB(0,0,0),RGB(212,208,200)
SetFont main,"Times New Roman",14,700,0,  BUTTON14
SetControlColor main,  BUTTON14,RGB(0,0,0),RGB(212,208,200)
CENTERWINDOW MAIN

gosub WriteToCombos
waituntil main=0


sub mainhandler

SELECT @MESSAGE
CASE @IDCLOSEWINDOW
CLOSEWINDOW MAIN:END

CASE @IDCONTROL
SELECT @CONTROLID
CASE BUTTON12
IF @NOTIFYCODE = 0
/*check answer button clicked*/
gosub checkthetext
ENDIF

CASE BUTTON14
IF @NOTIFYCODE = 0
/*quit button clicked*/
closewindow main:end
ENDIF

CASE BUTTON13
IF @NOTIFYCODE = 0
/*get new passage button clicked*/

gosub choosepassage

ENDIF

endselect
ENDSELECT
RETURN
endsub



REM THIS SUB IS TO WRITE DATA INTO EACH COMBOBOX AND THEN SET EACH TO '1'
SUB WriteToCombos
for x=1 to 10
ADDSTRING main,  COMBO1, str$(x)
ADDSTRING main,  COMBO2, str$(x)
ADDSTRING main,  COMBO3, str$(x)
ADDSTRING main,  COMBO4, str$(x)
ADDSTRING main,  COMBO5, str$(x)
ADDSTRING main,  COMBO6, str$(x)
ADDSTRING main,  COMBO7, str$(x)
ADDSTRING main,  COMBO8, str$(x)
ADDSTRING main,  COMBO9, str$(x)
ADDSTRING main,  COMBO10, str$(x)
next x

SETSELECTED main, COMBO1, 0
SETSELECTED main, COMBO2, 0
SETSELECTED main, COMBO3, 0
SETSELECTED main, COMBO4, 0
SETSELECTED main, COMBO5, 0
SETSELECTED main, COMBO6, 0
SETSELECTED main, COMBO7, 0
SETSELECTED main, COMBO8, 0
SETSELECTED main, COMBO9, 0
SETSELECTED main, COMBO10, 0
RETURN
endsub


sub checkthetext
RETURN
ENDSUB

sub choosepassage
$include "prologue.inc"
RESTORE ONE
X=0:
DATATEXT=""
Y=0
SAVEDSTRING=""
FOR X=1 TO 10
SETCONTROLTEXT MAIN,X,""
NEXT X


FOR X=1 TO 10
GETDATA ONE,DATATEXT
LABEL AGAIN
Y=RAND(1,10)
IF INSTR(SAVEDSTRING,STR$(Y))>0
GOTO AGAIN
ENDIF
SAVEDSTRING=SAVEDSTRING+STR$(Y)
SETCONTROLTEXT MAIN,Y,DATATEXT
NEXT X

RETURN
endsub
   
Adrian Fox

Ionic Wind Support Team

Adrian,
The debug window can be misleading.  Your program isn't loading those DLL's, the system is loading them into your process.  If you were to debug *any* executable you would see them on the same list.  They probably have system wide hooks.

As for your program.  A couple of quick things:


sub choosepassage
$include "prologue.inc"
....


Include statements belong at the top of your program and probably isn't doing what you think here.  It is not "loaded" in the sub.  The compiler just plasters whatever is in the include statement at that location during compile time, not during runtime. 

What do you think this logic is doing?


LABEL AGAIN
Y=RAND(1,10)
IF INSTR(SAVEDSTRING,STR$(Y))>0
GOTO AGAIN
ENDIF


All I can see it doing is delaying your code for a random amount of time. It is not affecting savedstring at all.

And finally...str$ always has a prepending space in its output.  So if you are trying to construct a string of ascii numbers then you need to use ltrim$ as such:

SAVEDSTRING=SAVEDSTRING+LTRIM$(STR$(Y))

Otherwise you end up with:

1 4 3 5 7 2

instead of
143572.

Similarly your do nothing delay code would need it in the instr statement:

IF INSTR(SAVEDSTRING,LTRIM$(STR$(Y)))>0

Paul.
Ionic Wind Support Team

AdrianFox

 ;D   Thanks very much for the help Paul, and for being patient with those of us who aren't great programmers.

First, I am so relieved that the DLLs didn't indicate a malware problem.  I'd begun to convince myself that the programs I've created all contained a virus or code to send out emails or something similar!   :-[ :-[

Second, thanks for setting me in the right direction on the code.  It took my poor addled brain some time to understand why  my supposed loop statement to filter out previously created random numbers wasn't actually doing anything, as you say.  (I'd moved the $include instruction to the sub in desperation to see if it made a difference! I don't normally do that, at least!)

I've solved my problem by doing the following, which at least does what I want it to do, even if it's not the most elegant way....

Doing the rest of this little program should be a breeze!  (Famous last words)

Thanks again for your patient explanations.

Adrian

sub choosepassage

RESTORE ONE
X=0:
DATATEXT=""
Y=0
FOR X=1 TO 10
SETCONTROLTEXT MAIN,X,""
NEXT X


FOR X=1 TO 10  'loop ten times
GETDATA ONE,DATATEXT   'get data from the data file... first sentence, then second etc
label again:
Y=RAND(1,10)
if getcontroltext (main,y)="" 'if there is nothing in this edit box
SETCONTROLTEXT MAIN,Y,DATATEXT 'add text to the edit box
else
goto again:
endif
NEXT X

RETURN
endsub



Adrian Fox