我在使用SYSCAL调用功能编号15(即SYS_CHMOD)更改文件的权限时遇到困难。这是我的代码片段:
mov eax, 15
mov ebx, fileName
mov ecx, 00400 | 00200 | 00040
int 80h
其中00400&00200 =由所有者读和写作,00040显然读了我的小组。
问题是该文件未正确设置。它为所有者设置了正确的设置,但是对于组而言,它没有设置读取,而是写入。然后,我尝试仅使用00400 |00200,发生了奇怪的事情,所有者设置了,但该组也设置为写作。
您忘了提及您正在使用的汇编程序。确保将这些数字解释为八分之一。例如,nasm不会并且会产生您看到的结果。
链接手册中的小报价:
mov ax,200 ; decimal
mov ax,0200 ; still decimal
mov ax,0200d ; explicitly decimal
mov ax,0d200 ; also decimal
mov ax,0c8h ; hex
mov ax,$0c8 ; hex again: the 0 is required
mov ax,0xc8 ; hex yet again
mov ax,0hc8 ; still hex
mov ax,310q ; octal
mov ax,310o ; octal again
mov ax,0o310 ; octal yet again
mov ax,0q310 ; octal yet again