MCPcopy Create free account
hub / github.com/capstone-engine/capstone / cs_winkernel_vsnprintf_test

Function cs_winkernel_vsnprintf_test

tests/test_winkernel.cpp:135–148  ·  view source on GitHub ↗

Functional test for cs_winkernel_vsnprintf()

Source from the content-addressed store, hash-verified

133
134// Functional test for cs_winkernel_vsnprintf()
135static void cs_winkernel_vsnprintf_test()
136{
137 char buf[10];
138 bool ok = true;
139 ok = (ok && cs_snprintf(buf, sizeof(buf), "%s", "") == 0 && strcmp(buf, "") == 0);
140 ok = (ok && cs_snprintf(buf, sizeof(buf), "%s", "0") == 1 && strcmp(buf, "0") == 0);
141 ok = (ok && cs_snprintf(buf, sizeof(buf), "%s", "012345678") == 9 && strcmp(buf, "012345678") == 0);
142 ok = (ok && cs_snprintf(buf, sizeof(buf), "%s", "0123456789") == 10 && strcmp(buf, "012345678") == 0);
143 ok = (ok && cs_snprintf(buf, sizeof(buf), "%s", "01234567890") == 11 && strcmp(buf, "012345678") == 0);
144 ok = (ok && cs_snprintf(buf, sizeof(buf), "%s", "0123456789001234567890") == 22 && strcmp(buf, "012345678") == 0);
145 if (!ok) {
146 printf("ERROR: cs_winkernel_vsnprintf_test() did not produce expected results!\n");
147 }
148}
149
150// Driver entry point
151EXTERN_C NTSTATUS DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)

Callers 1

DriverEntryFunction · 0.85

Calls 2

cs_snprintfFunction · 0.85
printfFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…