DevIL screenshot

Hi,
I am using the package DevIL for screenshot. However, I encounter a problem.
In my program, the viewport is only part of the window.
glViewport((GLsizei)w0.1, (GLsizei)h0.1 (GLsizei)w0.8, (GLsizei)h0.8);
Then when I use
ilutGLScreenie();
But the tga image I get is not what in the viewport as indicate in the tutorial. Instead, the tga image starts from the lower left corner of the window and going right 0.8 w and up 0.8 h(which is the viewport size)
What can I do if I want to the image to be everything in the whole window/or only in the viewport? Thanks.

I took a look at the source code. It seems that this is how ilutGLScreen is hard coded. It queries the size of viewport by glGetInteger() then use glReadPixels(0,0,Viewport[2],viewport[3],…);

I want to fix it and it requires to query the window size. Which function can return the window size? I am using GLUT under linux. Thanks.

I find it, it is glutGet().