freebasic / fbc

FreeBASIC is a completely free, open-source, multi-platform BASIC compiler, with syntax similar to MS-QuickBASIC, that adds new features such as pointers, object orientation, unsigned data types, inline assembly, and many others.
https://www.freebasic.net
877 stars 137 forks source link

How to modify FB code to use FB built-in functions in driver development? #367

Open MOODSKY2002 opened 2 years ago

MOODSKY2002 commented 2 years ago

I just want to know if it is possible for me to modify FB code to solve the problem, if it is not possible. I had to find another way to deal with it. For strings, for example, I now use the kernel string function to assign and add values, which is also useful, but inconvenient.

  1. Add code if driver compilation is normal: dim aa() as string Libfb. A did not consider the RING0 layer, but I do not know how to modify to normal)

E:\FreeBASIC-1.09.0-win64-winlibs-gcc-9.3.0\bin\win64\ld.exe GoDriver.o --subsystem=native --image-base=0x10000 --exclude-all-symbols --entry=DriverEntry@8 --nostdlib -shared -L "E:\1新代码\1GO驱动\lib" -l ntoskrnl_7 -l FBDDK -L D:\1驱动开发\FreeBASIC-1.09.0-win64-winlibs-gcc-9.3.0\lib\win64 -l fb -o GoDriver.sys D:\1驱动开发\FreeBASIC-1.09.0-win64-winlibs-gcc-9.3.0\bin\win64\ld.exe: D:\1驱动开发\FreeBASIC-1.09.0-win64-winlibs-gcc-9.3.0\lib\win64/libfb.a(array_erase.o):array_erase.c:(.text+0x31): undefined reference to free' D:\1驱动开发\FreeBASIC-1.09.0-win64-winlibs-gcc-9.3.0\bin\win64\ld.exe: D:\1驱动开发\FreeBASIC-1.09.0-win64-winlibs-gcc-9.3.0\lib\win64/libfb.a(array_resetdesc.o):array_resetdesc.c:(.text+0x30): undefined reference tomemset' D:\1驱动开发\FreeBASIC-1.09.0-win64-winlibs-gcc-9.3.0\bin\win64\ld.exe: D:\1驱动开发\FreeBASIC-1.09.0-win64-winlibs-gcc-9.3.0\lib\win64/libfb.a(str_del.o):str_del.c:(.text+0x16): undefined reference to free' D:\1驱动开发\FreeBASIC-1.09.0-win64-winlibs-gcc-9.3.0\bin\win64\ld.exe: D:\1驱动开发\FreeBASIC-1.09.0-win64-winlibs-gcc-9.3.0\lib\win64/libfb.a(thread_ctx.o):thread_ctx.c:(.text+0x35): undefined reference tocalloc' D:\1驱动开发\FreeBASIC-1.09.0-win64-winlibs-gcc-9.3.0\bin\win64\ld.exe: D:\1驱动开发\FreeBASIC-1.09.0-win64-winlibs-gcc-9.3.0\lib\win64/libfb.a(thread_ctx.o):thread_ctx.c:(.text+0x8e): undefined reference to free' D:\1驱动开发\FreeBASIC-1.09.0-win64-winlibs-gcc-9.3.0\bin\win64\ld.exe: D:\1驱动开发\FreeBASIC-1.09.0-win64-winlibs-gcc-9.3.0\lib\win64/libfb.a(array_clear.o):array_clear.c:(.text+0x17): undefined reference tomemset'

  1. Add code if driver compilation is normal: dim aa as zstring * 128 aa="123" The following error was reported:

E:\FreeBASIC-1.09.0-win64-winlibs-gcc-9.3.0\bin\win64\ld.exe GoDriver.o --subsystem=native --image-base=0x10000 --exclude-all-symbols --entry=DriverEntry@8 --nostdlib -shared -L "E:\1新代码\1GO驱动\lib" -l ntoskrnl_7 -l FBDDK -L D:\1驱动开发\FreeBASIC-1.09.0-win64-winlibs-gcc-9.3.0\lib\win64 -l fb -o GoDriver.sys D:\1驱动开发\FreeBASIC-1.09.0-win64-winlibs-gcc-9.3.0\bin\win64\ld.exe: D:\1驱动开发\FreeBASIC-1.09.0-win64-winlibs-gcc-9.3.0\lib\win64/libfb.a(array_erase.o):array_erase.c:(.text+0x31): undefined reference to free' D:\1驱动开发\FreeBASIC-1.09.0-win64-winlibs-gcc-9.3.0\bin\win64\ld.exe: D:\1驱动开发\FreeBASIC-1.09.0-win64-winlibs-gcc-9.3.0\lib\win64/libfb.a(array_resetdesc.o):array_resetdesc.c:(.text+0x30): undefined reference tomemset' D:\1驱动开发\FreeBASIC-1.09.0-win64-winlibs-gcc-9.3.0\bin\win64\ld.exe: D:\1驱动开发\FreeBASIC-1.09.0-win64-winlibs-gcc-9.3.0\lib\win64/libfb.a(str_del.o):str_del.c:(.text+0x16): undefined reference to free' D:\1驱动开发\FreeBASIC-1.09.0-win64-winlibs-gcc-9.3.0\bin\win64\ld.exe: D:\1驱动开发\FreeBASIC-1.09.0-win64-winlibs-gcc-9.3.0\lib\win64/libfb.a(thread_ctx.o):thread_ctx.c:(.text+0x35): undefined reference tocalloc' D:\1驱动开发\FreeBASIC-1.09.0-win64-winlibs-gcc-9.3.0\bin\win64\ld.exe: D:\1驱动开发\FreeBASIC-1.09.0-win64-winlibs-gcc-9.3.0\lib\win64/libfb.a(thread_ctx.o):thread_ctx.c:(.text+0x8e): undefined reference to free' D:\1驱动开发\FreeBASIC-1.09.0-win64-winlibs-gcc-9.3.0\bin\win64\ld.exe: D:\1驱动开发\FreeBASIC-1.09.0-win64-winlibs-gcc-9.3.0\lib\win64/libfb.a(array_clear.o):array_clear.c:(.text+0x17): undefined reference tomemset'

rversteegen commented 2 years ago

Try linking to libcntpr.lib which is apparently in the DDK and provides some libc function implementations for drivers.