I'm afraid this shall require some tests, esp. for the various return codes in case of failures (setting aside DIR output)
also, native cmd doesn't handle path:s longer than MAX_PATH characters, so this shall be detected and failed upon
is the use of ntdll APIs mandatory? I'd rather stick to kernel* if possible