English Amiga Board

English Amiga Board (http://eab.abime.net/index.php)
-   Coders. System (http://eab.abime.net/forumdisplay.php?f=113)
-   -   assembly code to test for assign (2.0+) (http://eab.abime.net/showthread.php?t=89956)

jotd 27 December 2017 22:07

assembly code to test for assign (2.0+)
 
I have this code to test for an assign. Ex: pass a pointer on "T:" in D0 and it returns 0 if not found

Code:

    move.l    _DosBase,A6
  move.l        D0,D5
  move.l    #LDF_READ|LDF_WRITE|LDF_ALL,D1
    JSRLIB    LockDosList
    move.l    D0,D6        ; head of dos list

    ; search in the list
   
    move.l    D5,D2
    move.l    #LDF_READ|LDF_WRITE,D3    ; flags
    move.l    D6,D1
    JSRLIB    FindDosEntry

    move.l    D0,D4            ; return

    ; unlock dos list

    move.l    #LDF_READ|LDF_WRITE,D1    ; flags
    JSRLIB    UnLockDosList

    move.l    D4,D0            ; NULL: not found

The issue with that code (took me a while to narrow it down) is that using it randomly locks my application on system calls like Read or Lock...

Someone knows why? I'd like to keep that code, but if I have to get rid of it and replace by a "Lock" I'll do it (since my app switches the requesters off, I suppose it won't be an issue)

Edit: replacing the flags by just
Code:

move.l    #LDF_READ,D1
fixes the lock but not sure if the test works in that case

ross 27 December 2017 23:38

Hi jotd, have You tried
move.l #LDF_READ|LDF_ALL,D1
?

From Autodocs there is a possible deadlock using LDF_WRITE without
AttemptLockDosList() before.

jotd 28 December 2017 00:16

tried that and it didn't lock, but didn't find the assign either. Anyway, used a good old "doslib.Lock" with requesters off, and it does exactly the same thing (I don't need assign, I need to see if the T: directory exists). Moreover, my code needs to be 1.3 compatible, so the Lock solution works. thanks


All times are GMT +2. The time now is 21:59.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.

Page generated in 0.06956 seconds with 11 queries