add regkey string length support
move ToParentAndPath to static function