You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
zhangxinyu b9e67ab6a6 初始化仓库 1 year ago
..
examples 初始化仓库 1 year ago
src 初始化仓库 1 year ago
.gitignore 初始化仓库 1 year ago
Cargo.toml 初始化仓库 1 year ago
README.md 初始化仓库 1 year ago
bindgen.sh 初始化仓库 1 year ago
cbindgen.toml 初始化仓库 1 year ago
memflow_win32.h 初始化仓库 1 year ago
memflow_win32_cpp.h 初始化仓库 1 year ago

README.md

memflow-win32-ffi

Crates.io build and test codecov MIT licensed Discord

The memflow win32 FFI crate provides an interface to the memflow-win32 API for C/C++. Currently a single memflow_win32.h file is generated aside from the dynamic library that can be used to interact with memflow.

This FFI library is intended to be used in combination with the memflow-ffi library.

A simple example that initializes the memflow-ffi and memflow-win32-ffi:

#include "memflow_win32.h"
#include <stdio.h>

int main(int argc, char *argv[]) {
	log_init(1);

	ConnectorInventory *inv = inventory_try_new();
	printf("inv: %p\n", inv);

	const char *conn_name = argc > 1? argv[1]: "kvm";
	const char *conn_arg = argc > 2? argv[2]: "";

	CloneablePhysicalMemoryObj *conn =
        inventory_create_connector(inv, conn_name, conn_arg);
	printf("conn: %p\n", conn);

	if (conn) {
		Kernel *kernel = kernel_build(conn);
		printf("Kernel: %p\n", kernel);
		Win32Version ver = kernel_winver(kernel);
		printf("major: %d\n", ver.nt_major_version);
		printf("minor: %d\n", ver.nt_minor_version);
		printf("build: %d\n", ver.nt_build_number);

		kernel_free(kernel);
	}

	inventory_free(inv);

	return 0;
}

Additional examples can be found in the examples folder as well as in the memflow-ffi crate.