I disagree with @jvazquez-r7 here. Post modules should never attempt to change their session's privileges unless that is the sole function of the module (e.g., privilege escalation). The getsystem command invokes a kernel exploit that is stable, but there is always a possibility that it may bluescreen boxes.

I think your approach of checking the actual error is preferable in this case because you will always need to run the CreateFile function anyway.