/****************************************************************************** * NtAccessCheckAndAuditAlarm (NTDLL.@) * ZwAccessCheckAndAuditAlarm (NTDLL.@) */ NTSTATUS WINAPI NtAccessCheckAndAuditAlarm(PUNICODE_STRING SubsystemName, HANDLE HandleId, PUNICODE_STRING ObjectTypeName, PUNICODE_STRING ObjectName, PSECURITY_DESCRIPTOR SecurityDescriptor, ACCESS_MASK DesiredAccess, PGENERIC_MAPPING GenericMapping, BOOLEAN ObjectCreation, PACCESS_MASK GrantedAccess, PBOOLEAN AccessStatus, PBOOLEAN GenerateOnClose) { FIXME("(%s, %p, %s, %p, 0x%08lx, %p, %d, %p, %p, %p), stub\n", debugstr_us(SubsystemName), HandleId, debugstr_us(ObjectTypeName), SecurityDescriptor, DesiredAccess, GenericMapping, ObjectCreation, GrantedAccess, AccessStatus, GenerateOnClose); return STATUS_NOT_IMPLEMENTED; }
LPCSTR debugstr_ObjectAttributes(const OBJECT_ATTRIBUTES *oa) { if (!oa) return "<null>"; return wine_dbg_sprintf( "{name=%s, attr=0x%08x, hRoot=%p, sd=%p}\n", debugstr_us(oa->ObjectName), oa->Attributes, oa->RootDirectory, oa->SecurityDescriptor ); }
void dump_ObjectAttributes (const OBJECT_ATTRIBUTES *oa) { if (oa) TRACE("%p:(name=%s, attr=0x%08lx, hRoot=0x%08x, sd=%p) \n", oa, debugstr_us(oa->ObjectName), oa->Attributes, oa->RootDirectory, oa->SecurityDescriptor); }
NTSYSAPI NTSTATUS WINAPI SYSCALL(NtQuerySystemEnvironmentValue)(PUNICODE_STRING VariableName, PWCHAR Value, ULONG ValueBufferLength, PULONG RequiredLength) { FIXME("(%s, %p, %u, %p), stub\n", debugstr_us(VariableName), Value, ValueBufferLength, RequiredLength); return STATUS_NOT_IMPLEMENTED; }
/****************************************************************************** * NtQuerySymbolicLinkObject [NTDLL.@] */ NTSTATUS WINAPI NtQuerySymbolicLinkObject( IN HANDLE LinkHandle, IN OUT PUNICODE_STRING LinkTarget, OUT PULONG ReturnedLength OPTIONAL) { FIXME("(0x%08x,%p,%p) stub\n", LinkHandle, debugstr_us(LinkTarget), ReturnedLength); return 0; }
/****************************************************************************** * NtCreateSymbolicLinkObject [NTDLL.@] */ NTSTATUS WINAPI NtCreateSymbolicLinkObject( OUT PHANDLE SymbolicLinkHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN PUNICODE_STRING Name) { FIXME("(%p,0x%08lx,%p, %p) stub\n", SymbolicLinkHandle, DesiredAccess, ObjectAttributes, debugstr_us(Name)); dump_ObjectAttributes(ObjectAttributes); return 0; }
/****************************************************************** * RtlQueryEnvironmentVariable_U [NTDLL.@] * * NOTES: when the buffer is too small, the string is not written, but if the * terminating null char is the only char that cannot be written, then * all chars (except the null) are written and success is returned * (behavior of Win2k at least) */ NTSTATUS WINAPI RtlQueryEnvironmentVariable_U(PWSTR env, PUNICODE_STRING name, PUNICODE_STRING value) { NTSTATUS nts = STATUS_VARIABLE_NOT_FOUND; PCWSTR var; unsigned namelen; TRACE("%p %s %p\n", env, debugstr_us(name), value); value->Length = 0; namelen = name->Length / sizeof(WCHAR); if (!namelen) return nts; if (!env) { RtlAcquirePebLock(); var = NtCurrentTeb()->Peb->ProcessParameters->Environment; } else var = env; var = ENV_FindVariable(var, name->Buffer, namelen); if (var != NULL) { value->Length = strlenW(var) * sizeof(WCHAR); if (value->Length <= value->MaximumLength) { memmove(value->Buffer, var, min(value->Length + sizeof(WCHAR), value->MaximumLength)); nts = STATUS_SUCCESS; } else nts = STATUS_BUFFER_TOO_SMALL; } if (!env) RtlReleasePebLock(); return nts; }
NTSYSAPI NTSTATUS WINAPI SYSCALL(NtQuerySystemEnvironmentValueEx)(PUNICODE_STRING name, LPGUID vendor, PVOID value, PULONG retlength, PULONG attrib) { FIXME("(%s, %s, %p, %p, %p), stub\n", debugstr_us(name), debugstr_guid(vendor), value, retlength, attrib); return STATUS_NOT_IMPLEMENTED; }
/****************************************************************************** * RtlSetEnvironmentVariable [NTDLL.@] */ NTSTATUS WINAPI RtlSetEnvironmentVariable(PWSTR* penv, PUNICODE_STRING name, PUNICODE_STRING value) { INT len, old_size; LPWSTR p, env; NTSTATUS nts = STATUS_VARIABLE_NOT_FOUND; MEMORY_BASIC_INFORMATION mbi; TRACE("(%p, %s, %s)\n", penv, debugstr_us(name), debugstr_us(value)); if (!name || !name->Buffer || !name->Length) return STATUS_INVALID_PARAMETER_1; len = name->Length / sizeof(WCHAR); /* variable names can't contain a '=' except as a first character */ for (p = name->Buffer + 1; p < name->Buffer + len; p++) if (*p == '=') return STATUS_INVALID_PARAMETER; if (!penv) { RtlAcquirePebLock(); env = NtCurrentTeb()->Peb->ProcessParameters->Environment; } else env = *penv; /* compute current size of environment */ for (p = env; *p; p += strlenW(p) + 1); old_size = p + 1 - env; /* Find a place to insert the string */ for (p = env; *p; p += strlenW(p) + 1) { if (!strncmpiW(name->Buffer, p, len) && (p[len] == '=')) break; } if (!value && !*p) goto done; /* Value to remove doesn't exist */ /* Realloc the buffer */ len = value ? len + value->Length / sizeof(WCHAR) + 2 : 0; if (*p) len -= strlenW(p) + 1; /* The name already exists */ if (len < 0) { LPWSTR next = p + strlenW(p) + 1; /* We know there is a next one */ memmove(next + len, next, (old_size - (next - env)) * sizeof(WCHAR)); } nts = NtQueryVirtualMemory(NtCurrentProcess(), env, 0, &mbi, sizeof(mbi), NULL); if (nts != STATUS_SUCCESS) goto done; if ((old_size + len) * sizeof(WCHAR) > mbi.RegionSize) { LPWSTR new_env; SIZE_T new_size = (old_size + len) * sizeof(WCHAR); new_env = NULL; nts = NtAllocateVirtualMemory(NtCurrentProcess(), (void**)&new_env, 0, &new_size, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE); if (nts != STATUS_SUCCESS) goto done; memmove(new_env, env, (p - env) * sizeof(WCHAR)); assert(len > 0); memmove(new_env + (p - env) + len, p, (old_size - (p - env)) * sizeof(WCHAR)); p = new_env + (p - env); RtlDestroyEnvironment(env); if (!penv) NtCurrentTeb()->Peb->ProcessParameters->Environment = new_env; else *penv = new_env; } else { if (len > 0) memmove(p + len, p, (old_size - (p - env)) * sizeof(WCHAR)); } /* Set the new string */ if (value) { memcpy( p, name->Buffer, name->Length ); p += name->Length / sizeof(WCHAR); *p++ = '='; memcpy( p, value->Buffer, value->Length ); p[value->Length / sizeof(WCHAR)] = 0; } done: if (!penv) RtlReleasePebLock(); return nts; }