Who has Item locked? How to find out. (OpenInsight Specific)
At 20 NOV 1998 02:36:33PM B. Cameron wrote:
I wrote a stored procedure that is called to lock a record or check
]]
Subroutine LockItem(Filevar,Idvar,NetworkCntr,Locked,LockError)
*
Equ True$ to 1
Equ False$ to 0
*
LCntr =1
Locked=False$
LockError=False$
*
Loop
Lock Filevar,Idvar ThenLocked=True$End ElseIf NetworkCntr ThenFor Nc=1 to 1000Next NcEndIf LCntr=10 ThenLockError=True$EndLCntr += 1EndUntil (Locked or LockError) Do Repeat
*
Return
(Please be critical if compelled…we like improvements)
]]
What I would like to do (for the clients running the NLM) is… if LockError returns true, display a message that the record is already locked by ?????. The ???? would be the Novell Network User name.
This seems to be do able since the NLMSTATS routine displays Netware user id's in its process.
Thanks
At 22 NOV 1998 03:57AM Steve wrote:
The locking strategy (ie choice of network driver) will determine your approach. If you are merely using logical locking, the code to get the logical lock owner (as defined in Novell's API) is quite complex.
As the NLM uses its own locking strategy, via its own internally derived calls, you'd have to ask the RevSoft gurus that one.
Here's an example of just how complex under Novell's standard logical locking API (all users require console privileges):
This example is for AREV-compatible object code.
Steve
CSEG SEGMENT PARA PUBLIC 'CODE' ASSUME CS:CSEG ROUTINE PROC FAR ORG 0 ; START AT ADDRESS ZERO. DB 'ASSM' ; 4-BYTE FLAG. DB 2 ; IDENTIFY AS ASSEMBLY ROUTINE. NO_ARGS DB 0 ; NUMBER OF ARGUMENTS PASSED. NO_COMS DW 0 ; NUMBER OF COMMON VARIABLES. DW 0 ; UNUSED. FUNCTION DD 0 ; ADDRESS FOR REV FUNCTION CALLS start: push ds ; clear out record buffer in memory push si push ax push cx mov ax,cs mov ds,ax mov al,0h mov cx,58D clc mov si,offset gfsi_i_req-1 clearbuf: inc si mov byte ptr cs:si,0h loop clearbuf pop cx pop ax pop si pop ds jmp begin steve1 label word charcount dw 0 param_len dw ? rrr dw ? rrrlen dw ? copyright DB 0FFh,'LOGICAL.LOCK.OWNER',0FFh DB 'Ver 5.0 Copyright (c) 1995, ' DB 'State of the Art Systems Pty. Ltd.' DB 0FFh,'All Rights reserved.',0FFh rqs label word rqst_buf_len dw 01h rqst_call db 0C8h db 90h rpl label word status dw ? gfsi_i_req label word ; get logical records output buffer gfsi_i_len db ?,? ;dw 0C00h ; 7-2 bytes to follow gfsi_i_fn Db ? ;0F0h ; function F0=get lock info gfsi_i_f3 db 00h gfsi_i_f4 db 00h glr_i_func db ? ;08h ; 8 chars to follow lock_name db 20 dup (0) gfsi_o_rsp label word ; get logical records output buffer gfsi_o_len dw ? ; lo-hi gfsi_o_next_req_record dw ? ; hi-lo gfsi_o_f1 dw ? gfsi_o_f2 dw ? gfsi_o_station db ? gfsi_o_locker db ? glr_o_fill db 12 dup (0) glr_o_print_term db 10 dup (0) db 20 dup (0) db 90h gfsi_2i_req label word ; get logical records output buffer gfsi_2i_len dw ? ;0500h ; 7-2 bytes to follow gfsi_2i_fn Db ? ;01Ch ; function F0=get lock info gfsi_2i_station db ? gfsi_2i_f4 db 00h gfsi_2i_f5 db 00h gfsi_2i_f6 db 00h glr_2i_func db ? ;08h ; 8 chars to follow db 40 dup (0) begin: mov charcount,0 cmp NO_ARGS,1 ; accept only one argument from AREV je ARGS_OK ; if not one then return null jmp done args_ok: mov dx,cs mov ds,dx mov es,dx ;-- Check for console operator privileges ; - if lacking then return null mov ah,0E3h mov si,offset rqs mov di,offset rpl int 21h cmp al,0C6h jne get_arg jmp done ;-- Get Argument from AREV get_arg: MOV rqst_buf_len,01h MOV rqst_call,0C8h MOV status,0h MOV gfsi_i_len1,0 MOV gfsi_i_fn,0 MOV gfsi_i_f3,00h MOV gfsi_i_f4,0h MOV glr_i_func,0H MOV lock_name1,0H MOV gfsi_o_len,7 MOV gfsi_o_next_req_record,0 MOV gfsi_o_f1,0 MOV gfsi_o_f2,0 MOV gfsi_o_station,0 MOV gfsi_o_locker1,0 MOV glr_o_fill1,0 MOV glr_o_print_term1,0 MOV gfsi_2i_len,0 MOV gfsi_2i_fn,0 MOV gfsi_2i_station,0 MOV gfsi_2i_f4,0 MOV gfsi_2i_f5,0 MOV gfsi_2i_f6,0 MOV glr_2i_func,0 mov ax,0D00h ; fetch AREV string pointer mov dx,01h ; string is passed as first parameter call function ; get string from AREV - DS:SI=ptr ; cx=number of chars. mov param_len,cx mov rrr,0h mov rrrlen,0h mov di,offset lock_name cmp cx,0 jne xfer ; 1st AREV parameter must be '' jmp done ; else return null xfer: mov al, byte ptr ds:si ;transfer input string mov BYTE PTR CS:DI,AL ;to our buffer, ASCIIZ format INC DI INC SI loop XFER MOV BYTE PTR CS:DI,0h cld clc mov dx,param_len mov glr_i_func,dl add dl,04h mov gfsi_i_len1, dl mov dx,cs mov ds,dx mov es,dx push dx push cx push bx push di push si process: mov ah,0DCh ;get stn number int 21h cmp al,0h jne stn_ok jmp windup ;no network station - return null stn_ok: mov ax,0F217h mov cx,0Eh mov cs:gfsi_i_fn, 0F0h ; function F0=get lock info mov cs:gfsi_i_f3, 00h mov cs:gfsi_i_f4, 00h mov cs:glr_i_func, 08h ; 8 chars to follow mov si,offset gfsi_i_req mov di,offset gfsi_o_rsp int 21h mov cx,gfsi_o_len jcxz windup ;if response length=0 ; no lock active mov ax,0f217H mov cx,07h mov si,offset gfsi_2i_req mov di,offset gfsi_o_rsp mov gfsi_2i_len,0500h mov gfsi_2i_fn,1Ch mov dl,gfsi_o_locker mov gfsi_2i_station,dl int 21h ;noparam: mov rrrlen,cx mov si,offset gfsi_o_len+6 mov rrr,si mov cs:rrrlen,0h printchar: mov dl,si inc si inc cs:rrrlen cmp dl,0h jne printchar dec cs:rrrlen windup: pop si pop di pop bx pop cx pop dx xor cx,cx mov si,offset gfsi_o_len+6 mov cx,cs:rrrlen done: mov cs:charcount,cx ; pass back answer to AREV mov cx,cs:charcount mov dx,cs mov ds,dx mov si,cs:rrr ; ds:si=string to return xor cx,cx ; allocate cx bytes for name mov cx,cs:charcount mov ah,0fh ; Ask AREV to allocate memory call function push di rep movsb ; put string into AREV variable pop di xor cx,cx mov cx,cs:charcount ; transfer length xor ax,ax xor dx,dx mov ah,10h ; transfer string to AREV call function ret routine endp CSEG ENDS END
At 23 NOV 1998 04:43PM [email protected] - [url=http://www.sprezzatura.com]Sprezzatura, Inc.[/url] wrote:
Another free goodie from your friends at Sprezzatura!
Write Object out to $WHOSELOCK
Then
RetVal=WhoseLock( FileName, RecordName )
RecordName must be assigned!!!
RetVal=UserName
RetVal=Network ID
If RecordName is Null then
RetVal=Record Keys
and all values will be @VM delimited
Object='
Object := \03150002006601A0010000EA64408001800CA8EB6B482400EC\
Object := \800140ED800D404A2C00EC801740ED801F40E8800CA8EE6B48\
Object := \6201EFEDE868802563AF40EE8027EEEE2480298027060A0640\
Object := \EEEE802B64216602EE24800C318036800C800C800C800CC0CD\
Object := \EA802F41078039F0EE800C65C0CDEA802F41078039F1EF800C\
Object := \8A6AC0CDEA802F4107F26440F1F263631E24635248C7008039\
Object := \F3EFF1F263631E8A6BC0CDEA802F4107EA48C40014FE14FD06\
Object := \14FD14FC06F3ABF1A7F26563F31B40F2A76402404A8A00F2A7\
Object := \640340F4800C40E924480C01E9F01D210014FDF5AC480501F0\
Object := \8A1EF5631EF01D1D0014FDF6AC480201F4F1F665631E14FE06\
Object := \F1F666631E06404A0901F4800C404A6201F7F01D1E0040F863\
Object := \40F96440FA800C40FB800C40F9485201FCF7F8F9D2FCF01D1D\
Object := \0014FDF6AC484F01FAA764640E63F1F665631E1B40FBA76464\
Object := \0E63F1F666631E1B404A2001F4FA14FE06FB0614FE06F01D21\
Object := \000640F429B8740A535953564F4C554D455300095359535441\
Object := \424C455307564F4C554D45530546494C45530158010D014203\
Object := \2E4C4B0652545035374102464C025354FE47454E4552414C5F\
Object := \4250FE57484F53454C4F434BFE31363A34323A323220203233\
Object := \204E4F562031393938\
At 24 NOV 1998 04:38AM Oystein Reigem wrote:
Aaron,
Nice utility for sure, but I get "variable has not been assigned a value" at line 1 when I run it. (The row I tested it with wasn't locked, but surely that can't be the problem???)
- Oystein -
At 24 NOV 1998 09:22AM [email protected] - [url=http://www.sprezzatura.com]Sprezzatura, Inc.[/url] wrote:
Could be you're not using the NLM? However, added new check to make sure NLM is active.
Object='
Object := \03150002009901D9010000EA6440C09FC09EE8ABC09FC09EE9\
Object := \AB8001800CA8EB6B483000EC800140ED800D404A3800EC8017\
Object := \40ED801F40EE800C40E8800CA8EF6B489501EF802564214895\
Object := \01F0EDE868802B63AF40EF802DEFEF24802F802D060A0640EF\
Object := \EF803164216602EF24800C31F1800C40F2800C40803C800C80\
Object := \0C800C800CC0CDEA80354107803FF1EF800C65C0CDEA803541\
Object := \07803FF2F0800C8A6AC0CDEA80354107803FF2EF800C8A6AC0\
Object := \CDEA80354107F36440F2F363631E24635248FA00F4800C4080\
Object := \3FF4EFF2F363631E8A6BC0CDEA80354107EA48F70014FE14FD\
Object := \0614FD14FC06F4ABF2A7F36563F41B40F3A76402404AB900F3\
Object := \A7640340EE800C40E924483F01E9F11D210014FDF5AC483801\
Object := \F18A1EF5631EF11D1D0014FDF6AC483501EEF2F665631E14FE\
Object := \06F2F666631E06404A3C01EE800C404A9501F7F11D1E0040F8\
Object := \6340F96440FA800C40FB800C40F9488501FCF7F8F9D2FCF11D\
Object := \1D0014FDF6AC488201FAA764640E63F2F665631E1B40FBA764\
Object := \640E63F2F666631E1B404A5301EEFA14FE06FB0614FE06F11D\
Object := \21000640EE29B8740A535953564F4C554D4553000953595354\
Object := \41424C455307564F4C554D45530546494C4553054646464646\
Object := \0158010D0142032E4C4B0652545035374102464C025354\
At 24 NOV 1998 09:31AM Oystein Reigem wrote:
Aaron,
Could be you're not using the NLM
Could be. And my car's an 86 model Nissan, with one of the doors in a different colour.
So does WhoseLock work strictly with the NLM? (If the answer is yes I don't need details.)
- Oystein -
At 24 NOV 1998 06:39PM Bob Watson wrote:
A big thankyou to Sprezzatura once again!!!
Bob Watson
At 24 NOV 1998 07:20PM [email protected] onmouseover=window.status=why not click here to send me email?;return(true)", [url=http://www.sprezzatura.com" onMouseOver=window.status=Why not click here to visit our web site?';return(true)]Sprezzatura Ltd[/url] wrote:
What I would like to do (for the clients running the NLM) is… if LockError returns true, display a message that the record is already locked by ?????. The ???? would be the Novell Network User name.
from the original message - hence Aaron's post!
PS What colour is the other door then?
World Leaders in all things RevSoft
At 25 NOV 1998 04:19AM Oystein Reigem wrote:
from the original message - hence Aaron's post!
Sorry - for some reason I missed the original and assumed Aaron started the thread.
PS What colour is the other door then?
The one I keep locked with a piece of string?
- Oystein -
At 25 NOV 1998 04:32AM Oystein Reigem wrote:
Sorry, Aaron - for some reason I missed the original message, overlooked the "Re:", and assumed you started the thread. That's why I didn't know your function was meant for the NLM.
Only one more thing - you replied twice to my posting, with different hex code. If I don't hear from you I assume your latest response contains the correct code.
- Oystein -
At 25 NOV 1998 08:27AM [email protected] - [url=http://www.sprezzatura.com]Sprezzatura, Inc.[/url] wrote:
Yes, the second one is the correct one. I'm not sure how I posted twice. I send a mail to Revelation asking them to delete the older of the two messages.
At 25 NOV 1998 11:43AM Karen Oland wrote:
Aaron,
Does this work in AREV also?
At 25 NOV 1998 11:46AM [email protected] - [url=http://www.sprezzatura.com]Sprezzatura, Inc.[/url] wrote:
It does with the NLM. The program was written on ARev 3.12.
At 03 JAN 2003 04:38AM Hippo wrote:
Thanks Aaron - works fine.