Announcement

Collapse
No announcement yet.

Weird Exceptio Access

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Weird Exceptio Access

    This routine wprks perfect in most computers but is giving me a weird error on a few computer.

    Exception Access violation (0x000005) 0x100039c3

    If I put a msgbox "Test" line it works fine.

    Is there a way to at least simulate the msgbox without actually showing anything?


    Thanks

    Pedro Camargo

    ----------------
    Code:
    IdeNumber = 1
    HW32=0
    
    proc = LoadLibrary("TVicHW32.DLL")
    gethdid="Not Loaded"
    IF proc THEN
                      
    funcaddr = GetProcAddress(proc, "OpenTVicHW32")
    
    IF funcaddr<> %NULL THEN
    'msgbox "Text"
    CALL DWORD funcaddr USING OpenTVicHW32X(HW32,"TVICHW32", "TVicDevice0") TO HW32
    END IF
    IF HW32<>0 THEN
    funcaddr = GetProcAddress(proc, "GetActiveHW")
    dummy=0
    IF funcaddr<>0 THEN
    CALL DWORD funcaddr USING GetActiveHWX(HW32) TO dummy
    END IF
    IF dummy<>0 THEN
        funcaddr = GetProcAddress(proc, "GetHDDInfo")
        CALL DWORD funcaddr USING GetHDDInfoX(HW32, IdeNumber, Master, HddInfo)
        'CALL GetHDDInfo(HW32, IdeNumber, Master, HddInfo)
        gethdid=UCASE$(TRIM$(HddInfo.Model)+"-"+TRIM$(HddInfo.SerialNumber))
        IF TRIM$(HddInfo.SerialNumber)="" THEN gethdid="No Info"
    '    HW32 = CloseTVicHW32(HW32)
        funcaddr=GetProcAddress(proc, "CloseTVicHW32")
        IF funcaddr<>%NULL THEN
        CALL DWORD funcaddr USING CloseTVicHW32X(HW32) TO dummy
        END IF
    END IF
    END IF
    CALL FreeLibrary(proc)
    END IF
    ------------------
    Pedro Camargo
    Pedro Camargo

  • #2
    It sounds like the DLL could need some small amount of time to initialize itself before it's functions are called. Remember, the MSGBOX statement takes time to be displayed and responded to by the user.

    Basically, I'd suggest that you should concentrate on tracking down the real cause of the problem, and forget trying to implement a MSGBOX.

    Can you pinpoint the place in the code where the exception/GPF is raised? Can you step through it in the debugger to locate the problem, or for example, insert a line of code before each statement to write to a log file to indicate the position of execution.

    I hope this helps!

    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    Lance
    mailto:[email protected]

    Comment


    • #3
      In your WIndows or Winnt directory you will find a file named drwtsn32.log or something to that effect....

      It will have all of the DLL's loaded at the time, will show the stack and will have something like this in it:

      FAULT======>


      Points to the fault.....may or may not help you but 0x000005 is generally either file permissions, or null pointer..
      Check your asciiz or string's, BYVAL or lack of's in your functions.....

      ------------------
      Scott

      [This message has been edited by Scott Turchin (edited May 22, 2001).]
      Scott Turchin
      MCSE, MCP+I
      http://www.tngbbs.com
      ----------------------
      True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

      Comment


      • #4
        Check your case sensitivity on OpenTVicHW32X and then check the parameters as to whether you should be using byval, sending a pointer, etc.....

        Try some asciiz statements
        Param1 as asciiz * 120, then send it or send it as byval varptr(Param1)...


        Also, not sure whether or not this is an activeX DLL (Ie VB6), but I have one called FREECCS.DLL that allows me to get that far, then blows up, and it turns out it's an AX DLl and I can't use it.....



        ------------------
        Scott
        Scott Turchin
        MCSE, MCP+I
        http://www.tngbbs.com
        ----------------------
        True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

        Comment


        • #5
          He says it works on some computers though, so the cause is probably more obscure...

          ------------------
          Lance
          PowerBASIC Support
          mailto:[email protected][email protected]</A>
          Lance
          mailto:[email protected]

          Comment


          • #6
            >It sounds like the DLL could need some small amount of time to initialize itself before it's functions are called

            Yes, sounds like this to me, too. Just try to insert

            Code:
            SLEEP 2000



            ------------------
            E-Mail (home): mailto:[email protected][email protected]</A>
            E-Mail (work): mailto:[email protected][email protected]</A>

            Comment


            • #7
              Thanks for your suggestions.

              I have already tried sleep 3000 and 5000. It does not work.

              It works fine on most machines with NT/ Me, win95/98, it only has this problem on some Dell Servers with NT 4.0

              And again, if I put a msgbox statement once I click on the box it works fine.


              Does the msgbox triggers or resets something else?

              Pedro Camargo

              --- Error log ----
              State Dump for Thread Id 0xcd

              eax=01010984 ebx=01010600 ecx=00000000 edx=704f0000 esi=00000000 edi=00000000
              eip=100039c3 esp=0012fc5c ebp=0012fd3c iopl=0 nv up ei ng nz ac pe cy
              cs=001b ss=0023 ds=0023 es=0023 fs=0038 gs=0000 efl=00000293


              function: <nosymbols>
              1000399a ff1588700010 call dword ptr [10007088] ds:10007088=77f02b02
              100039a0 8d8384030000 lea eax,[ebx+0x384] ds:01010984=00000000
              100039a6 894304 mov [ebx+0x4],eax ds:01f0f006=????????
              100039a9 33f6 xor esi,esi
              100039ab 89b540ffffff mov [ebp+0xffffff40],esi ss:0012fc7c=00000000
              100039b1 6683fe03 cmp si,0x3
              100039b5 7d46 jge 100039fd
              100039b7 897dfc mov [ebp-0x4],edi ss:0102e742=????????
              100039ba 0fbfce movsx ecx,si
              100039bd 8b953cffffff mov edx,[ebp+0xffffff3c] ss:0012fc78=704f0000
              FAULT ->100039c3 668b044a mov ax,[edx+ecx*2] ds:00000000=????
              100039c7 663bc7 cmp ax,di
              100039ca 7416 jz 100039e2
              100039cc 33c9 xor ecx,ecx
              100039ce 8a8b95030000 mov cl,[ebx+0x395] ds:01010995=00
              100039d4 6689844b84030000 mov [ebx+ecx*2+0x384],ax ds:00000384=????
              100039dc fe8395030000 inc byte ptr [ebx+0x395] ds:01010995=00
              100039e2 c745fcffffffff ss:0102e742=????????
              mov dword ptr [ebp-0x4],0xffffffff
              100039e9 e80e000000 call 100039fc
              100039ee 46 inc esi
              100039ef ebba jmp 100039ab
              100039f1 8b5d08 mov ebx,[ebp+0x8] ss:0102e742=????????

              *----> Stack Back Trace <----*

              FramePtr ReturnAd Param#1 Param#2 Param#3 Param#4 Function Name
              0012fd3c 0040f6fc 01010600 00134ce4 001349e4 00416746 <nosymbols>

              *----> Raw Stack Dump <----*
              0012fc5c 01 00 00 00 00 00 00 00 - 48 fd 12 00 ad be f6 77 ........H......w
              0012fc6c 00 00 00 00 2c 06 01 01 - 4c fd 12 00 00 00 4f 70 ....,...L.....Op
              0012fc7c 00 00 00 00 69 63 48 57 - 33 32 00 ff b0 fc 12 00 ....icHW32......
              0012fc8c dc 4d f6 77 94 00 00 00 - 04 00 00 00 00 00 00 00 .M.w............
              0012fc9c 65 05 00 00 02 00 00 00 - 53 65 72 76 69 63 65 20 e.......Service
              0012fcac 50 61 63 6b 20 36 00 00 - fd 3a f1 77 00 00 13 00 Pack 6...:.w....
              0012fcbc 00 00 00 00 c8 4a 13 00 - a3 07 00 00 f8 eb fd 7f .....J..........
              0012fccc 00 7b 00 10 90 4c 13 00 - 00 37 00 10 00 00 00 00 .{...L...7......
              0012fcdc 18 00 00 00 01 00 00 00 - f0 47 13 00 ab d8 f1 77 .........G.....w
              0012fcec 29 12 b2 77 00 00 13 00 - 00 00 00 00 10 00 00 00 )..w............
              0012fcfc ff 14 34 65 28 b2 bc 77 - 10 00 00 00 10 00 00 00 ..4e(..w........
              0012fd0c bf 3d 34 65 10 00 00 00 - 01 00 00 00 0c 7d 41 00 .=4e.........}A.
              0012fd1c 50 fe 12 00 4c fd 12 00 - 96 38 41 00 a4 fa 12 00 P...L....8A.....
              0012fd2c e0 ff 12 00 5c 3f 00 10 - b0 71 00 10 00 00 00 00 ....\?...q......
              0012fd3c 50 fe 12 00 fc f6 40 00 - 00 06 01 01 e4 4c 13 00 [email protected]
              0012fd4c e4 49 13 00 46 67 41 00 - 00 00 00 00 00 37 00 10 .I..FgA......7..
              0012fd5c 00 00 00 10 00 00 00 00 - 01 00 00 00 00 00 00 00 ................
              0012fd6c 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 ................
              0012fd7c 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 ................
              0012fd8c 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 ................

              State Dump for Thread Id 0xc9

              eax=100015a0 ebx=00134da0 ecx=0012fc50 edx=00000000 esi=7ffdf000 edi=00000000
              eip=77f682cb esp=0120ff24 ebp=0120ff78 iopl=0 nv up ei pl nz ac pe cy
              cs=001b ss=0023 ds=0023 es=0023 fs=0038 gs=0000 efl=00000213


              function: NtWaitForMultipleObjects
              77f682c0 b8c4000000 mov eax,0xc4
              77f682c5 8d542404 lea edx,[esp+0x4] ss:0210e92b=????????
              77f682c9 cd2e int 2e
              77f682cb c21400 ret 0x14
              77f682ce 8bc0 mov eax,eax

              *----> Stack Back Trace <----*

              FramePtr ReturnAd Param#1 Param#2 Param#3 Param#4 Function Name
              0120ff78 77f1cd76 00000010 01010748 00000000 ffffffff ntdll!NtWaitForMultipleObjects




              ------------------
              Pedro Camargo
              Pedro Camargo

              Comment


              • #8
                > 0012fc9c 65 05 00 00 02 00 00 00 - 53 65 72 76 69 63 65 20 e.......Service
                > 0012fcac 50 61 63 6b 20 36 00 00 - fd 3a f1 77 00 00 13 00 Pack 6...:.w....

                Perhaps a Problem with the NT Service Pack


                ------------------
                E-Mail (home): mailto:[email protected][email protected]</A>
                E-Mail (work): mailto:[email protected][email protected]</A>

                Comment


                • #9
                  I have this problem on 3 different machines Dell with SP 6.

                  I have also tried it on other machines with sp 6 and it works fine.


                  Pedro Camargo

                  ------------------
                  Pedro Camargo
                  Pedro Camargo

                  Comment


                  • #10
                    Running SP6 or SP6a?


                    Florent

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

                    Comment


                    • #11
                      Some have 6 others have 6a.

                      It even works on machines with sp 4

                      Thanks

                      Pedro

                      ------------------
                      Pedro Camargo
                      Pedro Camargo

                      Comment


                      • #12
                        pedro, do you by any chance have a sub or function anywhere in
                        the dll or in the program calling it, which takes an asciiz
                        argument? if so, check to see that you are not passing an
                        empty string to that routine. if so, that will likely cause a
                        problem which may manifest itself in an entirely different
                        location of your program, next to some innocent-looking code.
                        it may also not manifest itself at all. something like this
                        happened to me, and it was very tricky to track it down.

                        to check for this, make sure you use (at least temporarily):

                        $debug error on

                        then in every function/sub which takes an asciiz argument, add
                        an on error goto statement which prints the error. in
                        my case the actual error was trigged in a line similar to:

                        temp$ = ucase$(arg)

                        where arg is an argument passed as asciiz. however, the crash
                        happed from a host visual basic program. on further inspection,
                        it appeared to be caused by a an innocent line of pb code
                        somewhere totally removed from the actual source of the error.

                        unfortunately, i still haven't found a solid way to check for
                        null in this context. in a separate thread at http://www.powerbasic.com/support/pb...ad.php?t=18246
                        lance suggested that i check the varptr of the asciiz string
                        before using it. it looked like a great solution, but it didn't
                        work when i tried it.


                        ------------------
                        daniel corbier
                        ucalc fast math parser
                        http://www.ucalc.com
                        Daniel Corbier
                        uCalc Fast Math Parser
                        uCalc Language Builder
                        sigpic

                        Comment


                        • #13
                          Or: can you post the original C function prototypes as well
                          as your translation of them?

                          Cheers

                          Florent

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

                          Comment


                          • #14
                            Hmmm is it a Microsoft install of Windows or the original OEM versio nof Windows that DELL was allowed to modify?


                            Also, try re-registering the DLL, may or may not have anything to do with it but cannot hurt...
                            REGSVR32.exe DLLNAME.DLL



                            ------------------
                            Scott
                            Scott Turchin
                            MCSE, MCP+I
                            http://www.tngbbs.com
                            ----------------------
                            True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

                            Comment


                            • #15
                              The library is supposed to load dinamically.

                              I think is a dll problem.

                              My question is why if I insert a msgbox statement before the opne function it works fine?

                              I have already tried replacing the msgbox with sleep , a do..loop, nothing works.

                              I am trying to simulate a msgbox using a modal dialog.

                              I will be ready in a few minutes and I will let you know if that works.


                              Thanks for your assistance,

                              Pedro

                              ------------------
                              Pedro Camargo
                              Pedro Camargo

                              Comment


                              • #16
                                Ok. I got somethin new.

                                I replaced the msgbox with a modal dialog and it also works when I click the close button in the dialog.

                                Then I put a 2 sec. timer to automatically close the modal dialog and it does not work.

                                ???????????

                                Pedro

                                ------------------
                                Pedro Camargo
                                Pedro Camargo

                                Comment

                                Working...
                                X