Undefined behavior – это все, что явно не указано в документации.

??????? ?????? ??? ExUuidCreate ? ? ????????? ??? ???? ??????:

Well, I suggest MSFT to documented this behavior, or at least explain this case in documentation.

???????, ???? ?????? ???????? ? ????, ??? ??????? ExUuidCreate ????? ???????? ?????????? ????????????? ?????? ???? ? ??? ??????, ???? ??? ?????????? ??????. ?????, ? ????????????, ????????? ???? ?? ???? ????? ?? ??????? ????? ??????? ????? ? ?????? ??????.

??? ?????? ????????? ?????????? ?????? ??? ??????? ????? ????? ?????? ? ??????? ??? ??? ??????. ExUuidCreate ????????? ????????? ???????:

 NTSTATUS 
ExUuidCreate(
    OUT UUID *Uuid,
    );

?.?. ??? ????? ??????????????? GUID ? ?????, ?????????? ?????????? ????????. ??? ?????, ??? ???????? ???????? ??? “OUT” ????????. ?????????, ??? ??????? ????????????:

__out: The function will only write to the buffer. If used on the return value or with _deref, the function will provide the buffer and initialize it. Otherwise, the caller must provide the buffer, and the function will initialize it.

__out (??? ???? ?????, ??? ? OUT), ????????? ?? ??, ???:

  1. ?????????? ??????? ????? ?????? ?????? ? ?????;
  2. ?????????? ??????? ???????? ?? ????????? ??????.

?? ????? ? ????????? ?????? ? ?????? ????????? ??? ??????????? ??????. ??, ????????? ?????? ? ?????? ????????? ?????????? ??????? ? ???????????? ?? ???? ???????:

Uuid: Pointer to a caller-allocated UUID (GUID) structure that is set to a new UUID value.

????? ??? ???????????? ??????? ????????. ?????????? ? ??? ???????? ??? ??????:

  1. ??????? ?????????? ??????, ?????????? ?????? ?? ??????????;
  2. ??????? ?????????? ??????, ?????????? ?????? ??????????.

???? ???????, ??? ??????? ?? ?????? ???????? ?????????? ?????? ? ?????? ??????, ?? ???-?? ? ???????????? ?????? ???? ??????????????? ??????????. ?????? ??, ?????? ?????????? ??? ???, ?????????????? ?????????? ??? ????????. ????? – ????????? “OUT” ????????? ????????????? ? ?????? ??????????? ??????.

????? ?? ????? ??????? ?????? ??? ???????, ?? ?????????? ????????: ???, ??? ???? ?? ??????? ? ???????????? - ?? ??????????. ? ????? ?????, ????? ?????????? ???????? ??????? ????????????: ???????????? ?????, ???? ??? ?????????? ??????? ????????? ??????? (??????, ?????? ? ?.?.) ???????. ???? ???????????? ????????? ?????? ?????????? ?????????? , ?? ????? ???????????? ????????? ? ????????? ??????, ??? ??? ????????? ???????? ????????? ? ??? ? ???????.

Cross-posted from blog.not-a-kernel-guy.com.