Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| en:docs:mvm:api:0 [2024/11/07 05:34] – prokushev | en:docs:mvm:api:0 [2026/03/20 03:14] (current) – prokushev | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== | + | ====== |
| + | |||
| + | Duplicate a file handle. This call creates a new file handle that refers to the same open file, pipe, or device as an existing handle. | ||
| ===== Brief ===== | ===== Brief ===== | ||
| + | |||
| + | Duplicate file handle (INT 21h AH=45h) | ||
| ===== Input ===== | ===== Input ===== | ||
| - | * BX = file handle | + | * BX = existing |
| ===== Return ===== | ===== Return ===== | ||
| Line 12: | Line 16: | ||
| * AX = new handle | * AX = new handle | ||
| * CF set on error | * CF set on error | ||
| - | * AX = [[en: | + | * AX = [[en: |
| ===== Notes ===== | ===== Notes ===== | ||
| - | moving | + | * Both handles refer to the same system file table entry. Moving the file pointer for one handle also moves it for the other. |
| + | * Closing one handle does not affect the other until both are closed. | ||
| + | * The new handle has the same access rights and sharing mode as the original. | ||
| + | |||
| + | ===== Binding ===== | ||
| + | |||
| + | ==== MASM ==== | ||
| + | |||
| + | <code asm> | ||
| + | include macrolib.inc | ||
| + | |||
| + | mov bx, handle | ||
| + | @SvcDupHandle | ||
| + | |||
| + | handle dw 1234h | ||
| + | </ | ||
| + | |||
| + | ==== C ==== | ||
| + | |||
| + | <code c> | ||
| + | #include < | ||
| + | |||
| + | unsigned short newhandle; | ||
| + | unsigned short oldhandle = 0x1234; | ||
| + | |||
| + | newhandle = SvcDupHandle(oldhandle); | ||
| + | </ | ||
| + | |||
| + | The underlying pragma is defined as: | ||
| + | |||
| + | <code c> | ||
| + | extern unsigned short SvcDupHandle(unsigned short handle); | ||
| + | #pragma aux SvcDupHandle = \ | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | parm [bx] \ | ||
| + | value [ax] \ | ||
| + | modify [ax bx cx dx]; | ||
| + | </ | ||
| ===== See also ===== | ===== See also ===== | ||
| + | |||
| + | * [[en: | ||
| {{page> | {{page> | ||




