I had a similar problem, global $post; was returning NULL. But it works fine if I don’t use short codes.
So I found a function for getting the post id from the URI, you might be able to extend it to get more information if you need it.
Try this:
var_dump(url_to_postid($_SERVER['REQUEST_URI']));