윈도우 앱개발을 향하여

블로그 이미지
윈도우 10 스토어에 앱을 개발해 올리는 것을 목표로 하고 있습니다. 비전공자가 독학으로 시도하는 일이어서 얼마나 걸릴지 모르겠지만... 아무튼 목표는 그렇습니다!!
by 코딩하는 경제학도
  • Total hit
  • Today hit
  • Yesterday hit

Common Explorer Concepts 

( == Introduction to the Shell Namespace) (MSDN 번역)


The Shell namespace는 쉘에 의해 관리되는 file system과 other Object들을 single tree-structured 계층으로 organizes한다. (Shell namespace는 file system보다 큰 개념이다.)


목차

Introduction

Identifying Namespace Object

Item IDs

Item ID Lists

PIDLs

Allocating PIDLs



- Introduction


쉘(Shell)의 주요 업무 중 하나는 file system을 구성하는 다양하고 방대한 object(디스크 드라이브를 차지하는 폴더들과 파일들이 대표적)들에 대한 접근을 제공 및 관리하는 것이다. 하지만 쉘은 파일시스템에 포함되지 않은 것들과 virtual object들도 관리한다. (Network Printers, Other Networked computers, Control Panel applications, The Recycle Bin 같은 것들)


어떤 virtual object들은 물리적인 storage를 가지지 않기도 한다. 

(예를 들어 The printer object  contains a collection of links to networked printers. Other virtual objects, such as the Recycle Bin, may contain data that is stored on a disk drive, but needs to be handled differently than normal files. For example, a virtual object can be used to represent data stored in a database. In terms of the namespace, the various items in the database could appear in the Windows Explorer as separate objects, even though they are all stored in a single disk file.)


Virtual object들은 심지어 다른 컴퓨터에 위치할 수도 있다.

(예를 들어 to facilitate roaming, a user's document files might be stored on a server. To give users access to their files from multiple desktop PCs, the My Documents folder on the desktop PC they are currently using will point to the server, not the hard disk of the desktop PC. Its path will include either a mapped network drive or a UNC path name.)


Namespace도 file system과 마찬가지로 폴더와 파일이라는 두개의 기본적인 타입의 object들을 포함한다. 폴더 objects는 tree의 nodes로써 다른 폴더와 파일 object들의 컨테이너다.  파일 object들은 tree의 leaves로써 평범한 디스크 파일이거나 virtual objects이다.  파일 시스템의 일부가 아닌 폴더들은 virtual folders라고도 불린다.


파일 시스템 폴더들과 마찬가지로 가상 폴더(virtual folder)들도 시스템 환경에 따라 다르다. 가상 폴더들의 세 가지 classes는...

  • Standard virtual folders, such as the Recycle Bin, that are found on all systems.
  • Optional virtual folders that have standard names and functionality, but may not be present on all systems.
  • Non-standard folders that are installed by the user.
파일 시스템 폴더들과 달리 사용자는 가상 폴더들을 새롭게 만들 수 없고 단지 non-Microsoft 개발자가 만든 것을 설치할 수 밖에 없으므로 가상 폴더들은 파일 시스템 폴더들 보다 훨씬 적다. (가상 폴더 확장과 관련한 내용은 Namespace Extensions를 참조)


namespace 계층의 최상위에는 Desktop이 있고 그 바로 밑에는 My computer(내컴퓨터)와 휴지통 등과 같은 가상 폴더들이 있다. (윈도우 탐색기에서 바로 확인이 가능하다.)


다양한 디스크 드라이브들의 파일시스템들은 더 큰 namespace 계층의 일부로 보인다. 

(The roots of these file systems are subfolders of the My Computer folder. My Computer also includes the roots of any mapped network drives. Other nodes in the tree, such as My Documents, are virtual folders.)



- Identifying Namespace Objects


Namespace Object를 쓰기에 앞서 이것들을 구별하는 방법을 알아야 한다. 파일시스템의 object는 MyFile.htm과 같은 이름을 가지고 있을 수 있다. 하지만 동일한 이름의 파일이 시스템 내에 또 있을 수 있으므로 완전경로(Fully Qualified Path)("C:\MyDocs\MyFile.htm" 같은)를 요구한다. 이런 경로들은 기본적으로 파일시스템의 root인 C드라이브로부터 시작되는 모든 폴더명의 연속된 계층을 나열하고 마지막에 파일의 이름을 쓴 것이다.


하지만 완전경로는 파일시스템에 포함되있는 object들의 위치를 구별하는 데에는 유용하지만 virtual objects들에게 적용할 수 없다. 그래서 쉘은 모든 namespace object가 이용가능한 방법을 지원한다.


- Item IDs


Within a folder, each object는 item ID(which is the functional equivalent of a file or folder name)를 갖는다. Item ID는 실제로는 SHITEMID 구조체이다.


typedef struct _SHITEMID { 

USHORT cb; 

BYTE   abID[1]; 

} SHITEMID, * LPSHITEMID;


abID 멤버가 object의 구별자(identifier)이다. abID의 길이는 정해지지 않았고 그 값은 object를 포함하고 있는 폴더에 의해 결정된다. abID의 값이 폴더에 의해 결정되는 표준화된 방법이 없기 때문에 그 값들은 단지 해당 폴더 object와 함께할 때만 의미를 갖는다. Applications는 그 값들을 특정 폴더 내의 object들을 구별하는 토큰으로 취급하면 된다. Because the length of abID varies, the cb member holds the size of the SHITEMID structure, in bytes.


item ID가 display 목적으로 유용하지 않기 때문에 보통 해당 object를 포함하는 폴더가 object에게 display name을 배정한다. This is the name that is used by Windows Explorer when it displays the contents of a folder. (display names이 다루어지는 방법은 Getting Information From a Folder를 참조)


- Item ID Lists


Item ID가 그 자체로 쓰이는 경우는 별로 없고 보통은 item ID list의 일부로써 파일시스템의 경로와 동일한 목적으로 이용된다. 경로는 문자열로 이루어졌지만 item ID list는 ITEMIDLIST 구조체로 되어있다. 이 구조체는 item ID들의 연속으로 이루어지고 two-byte NULL로 끝이 난다. 


My Computer    C;/         MyDocs    MyFile.htm

ㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡ

|  cb  | abID   | cb | abID | cb | abID | cb | abID  | 2-byte NULL

ㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡ


item ID list안의 각 item ID는 namespace object와 일치한다. 그것들의 순서는 파일시스템의 경로처럼 namespace 내의 경로를 정의한다.



- PIDLs


쉘 API에서 namespace object들은 보통 ITEMIDLIST 구조체의 포인터(==Pointer to an item IDentifier List; PIDL)로 구별된다.


위 그림을 full(또는 absolute) PIDL이라고도 부를 수 있다. Full PIDL은 데스크탑부터 시작해서 중도에 있는 폴더들의 item ID를 포함하며 마지막에는 해당 object의 item ID와 two-byte NULL로 끝이 난다. Full PIDL은 완전경로와 비슷하고 Shell namespace내 object의 식별자 역활을 수행한다.


많은 함수들에서는 Full PIDL보다는 relative PIDL을 사용된다. relative PIDL의 root는 Desktop이 아닌 폴더이다. As with relative paths, the series of item IDs that make up the structure define a path in the namespace between two objects. Although they do not uniquely identify the object, they are usually smaller than a full PIDL and sufficient for many purposes.


The most commonly used relative PIDLs, single-level PIDLs, are relative to the object's parent folder. They contain only the object's item ID and a terminating NULL. Multi-level PIDLs are also used for many purposes. They contain two or more item IDs and typically define a path from a parent folder to an object through a series of one or more subfolders. Note that a single-level PIDL can still be a fully qualified PIDL. In particular, desktop objects are children of the desktop, so their fully qualified PIDLs contain only one item ID.


쉘 API는 object의 PIDL을 얻는 다양한 방법을 제공하는데 (그 방법은 Getting a Folder's ID 참조) 우리는 어떤 object의 PIDL을 다른 object의 PIDL과 구별하는 용도로 사용할 뿐 다른 용도로 이용하는 경우는 드물다. 따라서 PIDL의 내부는 공개되지 않았다.


- Allocationg PIDLs


PIDL들이 경로와 비슷하지만 그것의 사용방법은 다소 다르다. 특히 PIDL을 위한 메모리 할당과 해제가 그렇다. 경로가 문자열을 사용하는 것과 마찬가지로 PIDL도 반드시 메모리가 할당되어 사용된다(ITEMIDLIST 구조체를 위한 충분한 메모리 할당이 필수적). 대부분의 경우 쉘이 PIDL을 만들고 메모리 할당도 함께 한다. 그리고 보통 application에게 그 메모리를 해제할 책임이 있다. 이런 PIDL의 할당과 해제에는 CoTaskMemAlloc함수와 CoTaskMemFree함수가 쓰인다.





Common Explorer Concepts 

( == Introduction to the Shell Namespace) (MSDN 번역)

'MSDN > Shell Programming' 카테고리의 다른 글

Getting Information About the Contents of a Folder  (0) 2017.02.22
Getting a Folder's ID  (0) 2017.02.22
Understanding Shell Namespace Extensions  (0) 2017.02.22
AND

ARTICLE CATEGORY

분류 전체보기 (56)
Programming (45)
MSDN (4)
개발노트 (2)
reference (5)

RECENT ARTICLE

RECENT COMMENT

CALENDAR

«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31

ARCHIVE