본문 바로가기

컴퓨터 상식

Ctrl C하고 Ctrl V하면 어떤 일이 벌어질까?

https://superuser.com/questions/1436622/how-do-ctrlc-and-ctrlv-work

 

How do Ctrl+C and Ctrl+V work?

I was always wondering what happens under the hood (in the operating system) when I copy an image (selecting it and using Ctrl+C) into a Word file (pasting it with Ctrl+V), for example.

superuser.com

Windows는 이렇다.

 

윈도우에선 Cliboard API와 Storage Buffer가 커널에서 제공된다. Ctrl C를 누르는 순간 윈도우즈 Win32 API function SetClipboardData()가 발동해서 복사된 Data가 저장된다. 보통은 복사된 데이터는 OS가 관리하는 영역으로 들어가서 더 이상 source Program의 관리를 받지 않는다. 

 

Ctrl V를 누르면 프로그램이 가장 바람직한 Format을 선택하고 GetClipboardData() 함수를 발동시켜서 불러들인다.