# Reading EIP

What we can do is we can create a function which returns the value of EIP in EAX or any register which we can directly access.

```asmatmel
GetEIP proc
mov eax, dword ptr:ss[esp]
ret
GetEIP endp

:or

Call _getEip
_getEIP: pop eax
```

![](https://1846927083-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mj9GKP_mf1AnaApJEIA%2Fuploads%2F6nKztv0QImDoePcPv2hp%2Fimage.png?alt=media\&token=df36c535-7022-4e71-9580-6dcd7f1ba320)

![](https://1846927083-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mj9GKP_mf1AnaApJEIA%2Fuploads%2F5TpqB4hDk1KUy3TKDrLh%2Fimage.png?alt=media\&token=4f7d7878-6a83-4b4a-a11e-81ddca8bd505)
