#Pointer Increment Problem

1 messages · Page 1 of 1 (latest)

silk jewel
#

Code:

const haystack: *u16 = @ptrFromInt(data.BaseDllName.Buffer);
const needle = &s_kernel32[0];
var found: bool = false;
while (haystack.* != 0) : (haystack += 1) {
    const h: *const u16 = haystack;
    const n: *const u16 = needle;
    while (h.* != 0 and n.* != 0 and ((h.* | 0x20) == (n.* | 0x20))) {
        h += 1;
        n += 1;
    }
    if (!n.*) {
        found = true;
        break;
    }
    haystack += 1;
}

Error:

src/generate_shellcode.zig:134:33: note: type 'comptime_int' here
                        h = h + 1;
                                ^
sand rapids
#

use many item pointers [*]T

#

single item pointers dont support arithmatic

silk jewel
#

Ah I see. Maybe I'm too tired lol.